UNPKG

311 BJavaScriptView Raw
1var forEach = require('./each')
2
3module.exports = function indexedMap (each, fn) {
4 /* istanbul ignore next */
5 if (typeof each !== 'function') each = forEach.bind(this, each)
6 var result = {}
7 each(function () {
8 var item = fn.apply(this, arguments)
9 result[item[0]] = item[1]
10 })
11 return result
12}