This package has been deprecated

Author message:

No longer maintained

util-map

1.0.1 • Public • Published

Map

NPM version Build status Test coverage Gittip

Map over an object, array or string and keep the result as the same type.

Installation

npm install util-map --save

Usage

var map = require('util-map');
 
// Map over objects.
map({
  a: 0,
  b: 1,
  c: 2
}, function (value, key, obj) {
  return value + 10;
});
//=> { a: 10, b: 11, c: 12 }
 
// Map over arrays.
map(['a', 'b', 'c'], function (value, key, obj) {
  return String.fromCharCode(value.charCodeAt(0) + 1);
});
// => ['b', 'c', 'd']
 
// Map over strings.
map('abc', function (value, key, obj) {
  return key + 1;
});
//=> '123'

License

MIT

Package Sidebar

Install

npm i util-map

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • blakeembrey