Skip to content

kopa-app/dashify

 
 

Repository files navigation

dashify NPM version Build Status

Convert a camelcase or space-separated string to a dash-separated string.

I'm using this for converting object keys to dash-case. Most slugify libs are too heavy for this, so I made this as a fast and light alternative.

Install with npm

npm i dashify --save

Usage

var dashify = require('dashify');

dashify('fooBar');
//=> 'foo-bar'
dashify('fooBarBaz');
//=> 'foo-bar-baz'
dashify('foo bar');
//=> 'foo-bar'
dashify('foo barBaz');
//=> 'foo-bar-baz'
dashify('foo barBaz quux');
//=> 'foo-bar-baz-quux'

Run tests

Install dev dependencies:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb on February 12, 2015.

About

Convert a camelcase or space-separated string to a dash-separated string.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%