Skip to content
This repository has been archived by the owner on Aug 16, 2019. It is now read-only.

nezdemkovski/tslug

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tslug Build Status Greenkeeper badge

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

About

🔥Slugify URLs, filenames and IDs.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%