transform-obj-keys
Transform object keys easily using whatever transform function like:
camelcase
,decamelize
,uppercamelcase
,to-case
or simple String.prototype.toLowerCase()
Install
$ npm install --save transform-obj-keys
Usage
const transformObjKeys = ;const camelCase = ; // Convert an object;//=> {fooBar: true} // Convert an array of objects;//=> [{fooBar: true}, {barFoo: false}] ;//=> {fooBar: true, nested: {unicornRainbow: true}}
const transformObjKeys = ;const camelCase = ; const argv = processargv;//=> {_: [], 'foo-bar': true} ;//=> {_: [], fooBar: true}
API
transformObjKeys(input, transformFunc, [options])
input
Type: Object
Object[]
Object or array of objects to transform.
transformFunc
Type: Function
Function to manipulate strings
options
Type: Object
exclude
Type: string[]
RegExp[]
Default: []
Exclude keys from being transformed.
deep
Type: boolean
Default: false
Recurse nested objects and objects in arrays.
License
MIT © Martin Litvaj