You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

map-keys.js 407B

123456789101112131415161718
  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 result = {}, thisArg = arguments[2];
  7. callable(cb);
  8. forEach(
  9. obj,
  10. function (value, key, targetObj, index) {
  11. result[call.call(cb, thisArg, key, value, this, index)] = value;
  12. },
  13. obj
  14. );
  15. return result;
  16. };