Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including util-map with all npm packages installed. Try it out:

var utilMap = require("util-map")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

util-map v1.0.1

Map over an object, array or string


NPM version Build status Test coverage Gittip

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


npm install util-map --save


var map = require('util-map');

// Map over objects.
  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'



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free