Basic usage

Given an object and a toKey callback function, returns a new object with all the keys mapped through the toKey function. The callback is given both the key and value for each entry.

import { mapKeys } from 'radash'

const ra = {
  mode: 'god',
  power: 'sun'
}

mapKeys(ra, key => key.toUpperCase()) // => { MODE, POWER }
mapKeys(ra, (key, value) => value) // => { god: 'god', power: 'power' }

Testing

This _.mapKeys function is 100% covered by tests. See them and contribute at GitHub.

Source

See the source for _.mapKeys on GitHub.