humanize-keys
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

humanize-keys Build Status

Convert object keys to humanized words using humanize-string

Install

$ npm install humanize-keys

Usage

const humanizeKeys = require('humanize-keys');
 
// Convert an object
humanizeKeys({fooBar: true});
//=> {'Foo bar': true}
 
// Convert an array of objects
humanizeKeys([{fooBar: true}, {'bar-foo': false}]);
//=> [{'Foo bar': true}, {'Bar foo': false}]
 
humanizeKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true});
//=> {'Foo bar': true, nested: {'Unicorn rainbow': true}}
const humanizeKeys = require('humanize-keys');
 
const argv = require('minimist')(process.argv.slice(2));
//=> {_: [], 'foo-bar': true}
 
humanizeKeys(argv);
//=> {_: [], 'Foo bar': true}

API

humanizeKeys(input, [options])

input

Type: Object Object[]

Object or array of objects to humanize.

options

Type: Object

exclude

Type: Array<string|RegExp>
Default: []

Exclude keys from being humanized.

deep

Type: boolean
Default: false

Recurse nested objects and objects in arrays.

Related

License

MIT © Danier R.

Package Sidebar

Install

npm i humanize-keys

Weekly Downloads

32

Version

1.1.0

License

MIT

Unpacked Size

4.45 kB

Total Files

4

Last publish

Collaborators

  • drivas