modify-keys

2.0.0 • Public • Published

modify-keys

Modify the keys of an object

Install

npm install modify-keys

Usage

import modifyKeys from 'modify-keys';

modifyKeys({FOO: true, bAr: false}, (key, value) => key.toLowerCase());
//=> {foo: true, bar: false}

API

modifyKeys(input, transformer)

Modifies the keys and returns a new object.

input

Type: object

transformer(key, value)

Type: Function

Receives the key and value for each item and is expected to return the new key.

Related

See modify-values for modifying the values of an object.

Package Sidebar

Install

npm i modify-keys

Weekly Downloads

6

Version

2.0.0

License

MIT

Unpacked Size

2.62 kB

Total Files

4

Last publish

Collaborators

  • sindresorhus