Skip to content
This repository has been archived by the owner on Mar 8, 2019. It is now read-only.

ianstormtaylor/map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

map

Map an object or array.

Installation

$ component install ianstormtaylor/map
$ npm install ianstormtaylor/map

Example

Arrays:

var map = require('map');

map([1, 2, 3], function (val, i) {
  return 10 + val;
});

// [11, 12, 13]

Objects:

var map = require('map');

map({ a: 1, b: 2, c: 3 }, function (key, val) {
  return 10 + val;
});

// [11, 12, 13]

API

map(obj, iterator)

Map the obj using an iterator.

License

MIT