Skip to content

Convert sentences, titles and special characters to a url/filename/id-appropiate and readable slug

License

Notifications You must be signed in to change notification settings

kainiedziela/slugize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Convert sentences, titles and special characters to a url/filename/id-appropiate and readable slug

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published