1.0.0 • Published 8 years ago

@f/map-keys v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

map-keys

Build status Git tag NPM version Code style

Map the keys of an object.

Installation

$ npm install @f/map-keys

Usage

var mapKeys = require('@f/map-keys')

mapKeys(map, {foo: 'bar', qux: 'bat'}) // => {bar: 'bar', qux: 'bat'}

function map (key) {
  return key === 'foo' ? 'bar' : key
}

API

mapKeys(fn, obj)

  • fn - mapping function
  • obj - object to map keys of

Returns: an object whose keys have been mapped by fn

License

MIT