1.0.2 • Published 10 years ago
map-in v1.0.2
map-in
A helper module that implements an object mapper.
Installation
This module is installed via npm:
$ npm install map-in
Example Usage
var mapIn = require('map-in');
var doubled;
// Object case
doubled = mapIn({a: 1, b: 2}, function(num, key) {
return num * 2;
});
console.log(doubled); // {a 2, b: 4}
// Array case
var doubled = mapIn([1, 2], function(num, key) {
return num * 2;
});
console.log(doubled); // [2, 4]