1.0.0 • Published 5 years ago

@kainiedziela/slugize v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

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.