Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

paramcase-keys

alexluong6MIT0.1.0

Convert object keys to paramCase

map, obj, object, key, keys, value, values, val, iterate, paramcase, param-case, case, dash, hyphen, separator, string, text, convert, deep, recurse, recursive

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.

License

MIT