There're many npm packages that slugify string for you, some support unicode and some others even support CJK character. But I would never include a library which weights 2MB in browser. So that's the purpose of this library which only does basic transformation, eg: remove html tags / special chars / convert space to hyphen, and does not touch non-ascii chars. This is similar to the way GitHub handles the headings in README.
And the size of this library is about 700B minified and 400B gzipped.
yarn add slugo
const slugo = require('slugo') slugo('hello world, <strong>my kitten!</strong>') //=> hello-world-my-kitten
You can also access
window.slugo if you're using the CDN version.
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature