@kainiedziela/slugize
v1.0.0
Published
Convert sentences, titles and special characters to a url-appropiate slug
Downloads
1
Maintainers
Readme
slugize
Convert sentences, titles and special characters to a url/filename/id-appropiate and readable slug.
Installation
npm install @kainiedziela/slugize --save
Usage
import { slugize } from '@kainiedziela/sunday';
const slug = slugize(string);
slugize(string)
returns a string that had replaced special characters with latin alternatives, replaced spaces with dashes, removed periods, replaced non-alphanumerical characters with dashes, condensed consecutive dashes, lowercased and with the begging and end trimmed (so that the string doesn't start or end with a dash).
Testing
Tests are performed with Jest.
npm run test
This project is under the MIT license.