Skip to content

micro-js/map-values

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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(add1, {a: 1, b: 2, c: 3}) // -> [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

About

Map the values of an object to an array

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •