Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
var createObjectMapper = require('../internal/createObjectMapper');
2
3
/**
4
* The opposite of `_.mapValues`; this method creates an object with the
5
* same values as `object` and keys generated by running each own enumerable
6
* property of `object` through `iteratee`.
7
*
8
* @static
9
* @memberOf _
10
* @category Object
11
* @param {Object} object The object to iterate over.
12
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
13
* per iteration.
14
* @param {*} [thisArg] The `this` binding of `iteratee`.
15
* @returns {Object} Returns the new mapped object.
16
* @example
17
*
18
* _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
19
* return key + value;
20
* });
21
* // => { 'a1': 1, 'b2': 2 }
22
*/
23
var mapKeys = createObjectMapper(true);
24
25
module.exports = mapKeys;
26
27