The opposite of `mapValues` this method creates an object with the same values as `object` and keys generated by running each own enumerable string keyed property of `object` thru `iteratee`. The iteratee is invoked with three arguments: (value, key, object).
mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
return key + value
})
// => { 'a1': 1, 'b2': 2 }
| Name | Type | Attribute | Description |
|---|---|---|---|
| object | The object to iterate over. | ||
| iteratee | The function invoked per iteration. |
{
"comment": "/**\r\n * The opposite of `mapValues` this method creates an object with the\r\n * same values as `object` and keys generated by running each own enumerable\r\n * string keyed property of `object` thru `iteratee`. The iteratee is invoked\r\n * with three arguments: (value, key, object).\r\n *\r\n * @since 3.8.0\r\n * @category Object\r\n * @param {Object} object The object to iterate over.\r\n * @param {Function} iteratee The function invoked per iteration.\r\n * @returns {Object} Returns the new mapped object.\r\n * @see mapValues\r\n * @example\r\n *\r\n * mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\r\n * return key + value\r\n * })\r\n * // => { 'a1': 1, 'b2': 2 }\r\n */",
"meta": {
"range": [
721,
927
],
"filename": "mapKeys.js",
"lineno": 22,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100005825",
"name": "mapKeys",
"type": "FunctionDeclaration",
"paramnames": [
"object",
"iteratee"
]
},
"vars": {
"result": "mapKeys~result",
"": null
}
},
"description": "The opposite of `mapValues` this method creates an object with the\rsame values as `object` and keys generated by running each own enumerable\rstring keyed property of `object` thru `iteratee`. The iteratee is invoked\rwith three arguments: (value, key, object).",
"since": "3.8.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Object",
"value": "Object"
}
],
"params": [
{
"type": {
"names": [
"Object"
]
},
"description": "The object to iterate over.",
"name": "object"
},
{
"type": {
"names": [
"function"
]
},
"description": "The function invoked per iteration.",
"name": "iteratee"
}
],
"returns": [
{
"type": {
"names": [
"Object"
]
},
"description": "Returns the new mapped object."
}
],
"see": [
"mapValues"
],
"examples": [
"mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\r return key + value\r})\r// => { 'a1': 1, 'b2': 2 }"
],
"name": "mapKeys",
"longname": "mapKeys",
"kind": "function",
"scope": "global",
"___id": "T000002R000543",
"___s": true,
"filepath": "mapKeys.js"
}