$ npm install camelize
recursively transform key strings to camel-case
var camelize = require('camelize');
var obj = {
fee_fie_foe: 'fum',
beep_boop: [
{ 'abc.xyz': 'mno' },
{ 'foo-bar': 'baz' }
]
};
var res = camelize(obj);
console.log(JSON.stringify(res, null, 2));
output:
{
"feeFieFoe": "fum",
"beepBoop": [
{
"abcXyz": "mno"
},
{
"fooBar": "baz"
}
]
}
var camelize = require('camelize')
Convert the key strings in obj
to camel-case recursively.
With npm do:
npm install camelize
To use in the browser, use browserify.
MIT
© 2010 - cnpmjs.org x YWFE | Home | YWFE