.. | ||
example | ||
test | ||
.jshintrc | ||
.travis.yml | ||
index.js | ||
LICENSE | ||
package.json | ||
readme.markdown |
dasherize
recursively transform key strings to dash-case
example
var dasherize = require('dasherize');
var obj = {
feeFieFoe: 'fum',
beepBoop: [
{ 'abcXyz': 'mno' },
{ 'fooBar': 'baz' }
]
};
var res = dasherize(obj);
console.log(JSON.stringify(res, null, 2));
output:
{
"fee-fie-foe": "fum",
"beep-boop": [
{
"abc-xyz": "mno"
},
{
"foo-bar": "baz"
}
]
}
methods
var dasherize = require('dasherize')
dasherize(obj)
Convert the key strings in obj
to dash-case recursively.
dasherize(str)
Convert the string to dash-case.
install
With npm do:
npm install dasherize
To use in the browser, use browserify.
license
derives directly from camelize
MIT