@f/map-values

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @f/map-values

Weekly Downloads

5

Version

1.0.0

License

MIT

Last publish

Collaborators

  • f