@ndhoule/map

2.0.1 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i @ndhoule/map

Weekly Downloads

132,348

Version

2.0.1

License

MIT

Last publish

Collaborators

  • ndhoule