Package detail

@ndhoule/map

ndhoule385.9kMIT2.0.1

Apply a function to a each element of a collection and return a new array of results.

component

readme

map CI

Apply a function to a each element of a collection and return a new array of results.

Installation

$ component install ndhoule/map
$ npm install @ndhoule/map

API

map(iterator : Function, collection : Object|Array|string) => Array

Produce a new array by passing each value in the input collection through an iterator function and accumulating the results. The iterator is passed three arguments: (value, index, collection).

var square = function(x) { return x * x; };

map(square, [1, 2, 3]);
//=> [1, 4, 9]

License

Released under the MIT license.

changelog

2.0.1

  • Bump @ndhoule/each, @ndhoule/keys dependency to fix Browserify builds

2.0.0

  • Remove Component/Duo support

1.0.2

  • Fix Duo compatibility

1.0.1

  • Use scoped package
  • Ensure npm@>=2.7.0 on Travis CI
  • Move git dependencies to npm packages
  • Update Makefile
  • Update installation instructions

1.0.0

Initial release