npm.io
0.1.0 • Published 7 years ago

paramcase-keys

Licence
MIT
Version
0.1.0
Deps
3
Size
3 kB
Vulns
0
Weekly
0

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.

License

MIT

Keywords