$ gnpm 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
Copyright 2013 - present © cnpmjs.org | Home |