UNPKG

726 BMarkdownView Raw
1# array-map
2
3`[].map(f)` for older browsers
4
5[![testling badge](https://ci.testling.com/substack/array-map.png)](https://ci.testling.com/substack/array-map)
6
7[![build status](https://secure.travis-ci.org/substack/array-map.png)](http://travis-ci.org/substack/array-map)
8
9# example
10
11``` js
12var map = require('array-map');
13var letters = map([97,98,99], function (c) {
14 return String.fromCharCode(c);
15});
16console.log(letters.join(''));
17```
18
19output:
20
21```
22abc
23```
24
25# methods
26
27``` js
28var map = require('array-map')
29```
30
31## var ys = map(xs, f)
32
33Create a new array `ys` by applying `f(xs[i], i, xs)` to each element in `xs` at
34index `i`.
35
36# install
37
38With [npm](https://npmjs.org) do:
39
40```
41npm install array-map
42```
43
44# license
45
46MIT