snakeize
recursively transform key strings from camel-case to underscore-style. Derives directly from substack's camelize
example
var snakeize = ;var obj =feeFieFoe: 'fum'beepBoop:'abcXyz': 'mno''FooBar': 'baz''CheeseID': 'wensleydale';var res = ;console;
output:
{
"fee_fie_foe": "fum",
"beep_boop": [
{
"abc_xyz": "mno"
},
{
"foo_bar": "baz"
},
{
"cheese_id": "wensleydale"
}
]
}
methods
var snakeize =
snakeize(obj)
Convert the key strings in obj
from camel-case to underscore-stlye recursively.
install
With npm do:
npm install snakeize
To use in the browser, use browserify or component:
component install nathan7/snakeize
license
MIT