UNPKG

500 BJavaScriptView Raw
1var forOwn = require('./forOwn');
2var makeIterator = require('../function/makeIterator_');
3
4 /**
5 * Creates a new object where all the values are the result of calling
6 * `callback`.
7 */
8 function mapValues(obj, callback, thisObj) {
9 callback = makeIterator(callback, thisObj);
10 var output = {};
11 forOwn(obj, function(val, key, obj) {
12 output[key] = callback(val, key, obj);
13 });
14
15 return output;
16 }
17 module.exports = mapValues;
18