Most slugify libs cover way too many corner cases and are bloated and slow as a result. I made this as a fast and light alternative (it even supports diacritics in ~12 sloc).
Usage
var dashify = require('dashify');console.log(dashify('fooBar'));//=> 'foo-bar'console.log(dashify('fooBarBaz'));//=> 'foo-bar-baz'console.log(dashify('foo bar'));//=> 'foo-bar'console.log(dashify('foo barBaz'));//=> 'foo-bar-baz'console.log(dashify('foo barBaz quux'));//=> 'foo-bar-baz-quux'console.log(dashify('São Tomé and Príncipe'));
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running Tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
Building docs
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command: