Slugify URLs, filenames and IDs.
$ yarn add tslug
or
$ npm install tslug
import tslug from 'tslug';
tslug('Hello World');
//=> 'hello-world'
tslug(' Déjà Vu! ');
//=> 'deja-vu'
tslug('fooBar 123 $#%');
//=> 'foo-bar-123'
tslug('BAR and baz', { separator: '_' });
//=> 'bar_and_baz'
tslug('GraphQL', { decamelize: false });
//=> 'graphql'
tslug('Foo Bar', { lowerCase: false });
//=> 'Foo-Bar'
tslug('FooBar Baz', {
separator: '@',
decamelize: false,
lowerCase: true,
});
//=> 'foobar@baz'
Type: string
Type: Object
Type: string
Default: -
Type: boolean
Default: true
Type: boolean
Default: true
MIT © Yuri Yakovlev
Based on the original Slugify by Sindre Sorhus