Added the Porter Stemmer module to improve searches. This doesn't deal with some...
[yaffs-website] / node_modules / uncss / node_modules / lodash / mapKeys.js
1 var baseForOwn = require('./internal/baseForOwn'),
2     baseIteratee = require('./internal/baseIteratee');
3
4 /**
5  * The opposite of `_.mapValues`; this method creates an object with the
6  * same values as `object` and keys generated by running each own enumerable
7  * property of `object` through `iteratee`.
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  * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
18  *   return key + value;
19  * });
20  * // => { 'a1': 1, 'b2': 2 }
21  */
22 function mapKeys(object, iteratee) {
23   var result = {};
24   iteratee = baseIteratee(iteratee, 3);
25
26   baseForOwn(object, function(value, key, object) {
27     result[iteratee(value, key, object)] = value;
28   });
29   return result;
30 }
31
32 module.exports = mapKeys;