1.0.3 • Published 6 years ago

tslug v1.0.3

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

tslug Build Status

Slugify URLs, filenames and IDs.

Install

$ yarn add tslug

or

$ npm install tslug

Usage

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'

API

tslug(input, options)

input

Type: string

options

Type: Object

separator

Type: string\ Default: -

decamelize

Type: boolean\ Default: true

lowerCase

Type: boolean\ Default: true

License

MIT © Yuri Yakovlev\ Based on the original Slugify by Sindre Sorhus