npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

modify-keys

2.0.0

@sindresorhus

npmHomeRepoSnykSocket
Downloads:0
$ npm install modify-keys
DailyWeeklyMonthlyYearly

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.