1 2 3 4 5 6 7 8 9 | 1× 1× 2× 2× 4× 2× | const forEach = require('./each') module.exports = function mapObject (each, fn) { if (typeof each !== 'function') each = forEach.bind(this, each) const result = {} each(function (val, key) { result[key] = fn.apply(this, arguments) }) return result } |