Security update for permissions_by_term
[yaffs-website] / node_modules / uncss / node_modules / lodash / mapValues.js
1 var baseForOwn = require('./internal/baseForOwn'),
2     baseIteratee = require('./internal/baseIteratee');
3
4 /**
5  * Creates an object with the same keys as `object` and values generated by
6  * running each own enumerable property of `object` through `iteratee`. The
7  * iteratee function is invoked with three arguments: (value, key, object).
8  *
9  * @static
10  * @memberOf _
11  * @category Object
12  * @param {Object} object The object to iterate over.
13  * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
14  * @returns {Object} Returns the new mapped object.
15  * @example
16  *
17  * var users = {
18  *   'fred':    { 'user': 'fred',    'age': 40 },
19  *   'pebbles': { 'user': 'pebbles', 'age': 1 }
20  * };
21  *
22  * _.mapValues(users, function(o) { return o.age; });
23  * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
24  *
25  * // using the `_.property` iteratee shorthand
26  * _.mapValues(users, 'age');
27  * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
28  */
29 function mapValues(object, iteratee) {
30   var result = {};
31   iteratee = baseIteratee(iteratee, 3);
32
33   baseForOwn(object, function(value, key, object) {
34     result[key] = iteratee(value, key, object);
35   });
36   return result;
37 }
38
39 module.exports = mapValues;