object-keys-map
v1.0.2
Published
`Array.prototype.map` for object keys
Downloads
9,958
Readme
object-keys-map
Array.prototype.map
for object keys.
Usage
var assert = require('assert');
var objmap = require('object-keys-map');
var o1 = {
foo: 'bar',
bar: 'foo'
};
objmap(o1, function (key) {
return 'foo/' + key;
}); // => `{ 'foo/foo': 'bar', 'foo/bar': 'foo' }`
API
objectKeysMap(obj, iterator, this)
obj
(object
) - object to map oniterator
(function
, required) - iterator functionthis
(optional) -this
foriterator
Iterates over keys of obj
and creates a new object with keys based on return
value of iterator
and values from obj
.