|
2 ani în urmă | |
---|---|---|
.. | ||
LICENSE | 2 ani în urmă | |
README.md | 2 ani în urmă | |
index.js | 2 ani în urmă | |
package.json | 2 ani în urmă |
Convert a camelcase or space-separated string to a dash-separated string. ~12 sloc, fast, supports diacritics.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Install with npm:
$ npm install --save dashify
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).
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'));
//=> 'são-tomé-and-príncipe'
Type: boolean
Default: undefined
Condense multiple consecutive dashes to one.
console.log(dashify('Foo----Bar'));
//=> 'foo----bar'
console.log(dashify('Foo----Bar', {condense: true}));
//=> 'foo-bar'
Other awesome string libs you might like:
| Commits | Contributor |
| --- | --- |
| 23 | jonschlinkert |
| 1 | der-On |
| 1 | jeffreypriebe |
Jon Schlinkert
Copyright © 2018, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.8.0, on November 19, 2018.