1.0.0 • Published 8 years ago

@f/map-values v1.0.0

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

map-values

Build status Git tag NPM version Code style

Map the values of an object to an array.

Note: This is the opposite meaning of mapValues that lodash uses

Installation

$ npm install @f/map-values

Usage

var mapValues = require('@f/map-values')

mapValues({a: 1, b: 2, c: 3}, add1) // -> [2, 3, 4]

function add1 (n) {
  return n + 1
}

API

mapValues(fn, obj)

  • fn - fn(val, key) -> newVal. Receives val and key, and returns a new value to be put in the resulting array.
  • obj - The object who's values to map

Returns: An array containing the result of calling fn on each value and key within obj.

License

MIT