paramcase-keys
v0.1.0
Published
Convert object keys to paramCase
Downloads
15
Maintainers
Readme
paramcase-keys
Convert object keys to paramCase using
param-case
Install
$ npm install paramcase-keys
Usage
const paramcaseKeys = require("paramcase-keys")
// Convert an object
paramcaseKeys({ fooBar: true })
//=> { "foo-bar": true }
// Convert an array of objects
paramcaseKeys([{ fooBar: true }, { barFoo: false }])
//=> [{ "foo-bar": true }, { "bar-foo": false }]
paramcaseKeys({ fooBar: true, nested: { unicorn_rainbow: true } }, { deep: true })
//=> { "foo-bar": true, nested: { "unicorn-rainbow": true } }
API
paramcaseKeys(input, [options])
input
Type: Object
Object[]
Object or array of objects to paramCase.
options
Type: Object
exclude
Type: Array<string|RegExp>
Default: []
Exclude keys from being paramCased.
deep
Type: boolean
Default: false
Recurse nested objects and objects in arrays.
Related
License
MIT