1
0

map.js 364 B

123456789101112131415
  1. 'use strict';
  2. var callable = require('./valid-callable')
  3. , forEach = require('./for-each')
  4. , call = Function.prototype.call;
  5. module.exports = function (obj, cb/*, thisArg*/) {
  6. var o = {}, thisArg = arguments[2];
  7. callable(cb);
  8. forEach(obj, function (value, key, obj, index) {
  9. o[key] = call.call(cb, thisArg, value, key, obj, index);
  10. });
  11. return o;
  12. };