This method is like `findKey` except that it iterates over elements of a collection in the opposite order.
const users = {
'barney': { 'age': 36, 'active': true },
'fred': { 'age': 40, 'active': false },
'pebbles': { 'age': 1, 'active': true }
}
findLastKey(users, ({ age }) => age < 40)
// => returns 'pebbles' assuming `findKey` returns 'barney'
| Name | Type | Attribute | Description |
|---|---|---|---|
| object | The object to inspect. | ||
| predicate | The function invoked per iteration. |
{
"comment": "/**\r\n * This method is like `findKey` except that it iterates over elements of\r\n * a collection in the opposite order.\r\n *\r\n * @since 2.0.0\r\n * @category Object\r\n * @param {Object} object The object to inspect.\r\n * @param {Function} predicate The function invoked per iteration.\r\n * @returns {string|undefined} Returns the key of the matched element,\r\n * else `undefined`.\r\n * @see find, findIndex, findKey, findLast, findLastIndex\r\n * @example\r\n *\r\n * const users = {\r\n * 'barney': { 'age': 36, 'active': true },\r\n * 'fred': { 'age': 40, 'active': false },\r\n * 'pebbles': { 'age': 1, 'active': true }\r\n * }\r\n *\r\n * findLastKey(users, ({ age }) => age < 40)\r\n * // => returns 'pebbles' assuming `findKey` returns 'barney'\r\n */",
"meta": {
"range": [
858,
960
],
"filename": "findLastKey.js",
"lineno": 26,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100002525",
"name": "findLastKey",
"type": "FunctionDeclaration",
"paramnames": [
"object",
"predicate"
]
}
},
"description": "This method is like `findKey` except that it iterates over elements of\ra collection in the opposite order.",
"since": "2.0.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Object",
"value": "Object"
}
],
"params": [
{
"type": {
"names": [
"Object"
]
},
"description": "The object to inspect.",
"name": "object"
},
{
"type": {
"names": [
"function"
]
},
"description": "The function invoked per iteration.",
"name": "predicate"
}
],
"returns": [
{
"type": {
"names": [
"string",
"undefined"
]
},
"description": "Returns the key of the matched element,\r else `undefined`."
}
],
"see": [
"find, findIndex, findKey, findLast, findLastIndex"
],
"examples": [
"const users = {\r 'barney': { 'age': 36, 'active': true },\r 'fred': { 'age': 40, 'active': false },\r 'pebbles': { 'age': 1, 'active': true }\r}\r\rfindLastKey(users, ({ age }) => age < 40)\r// => returns 'pebbles' assuming `findKey` returns 'barney'"
],
"name": "findLastKey",
"longname": "findLastKey",
"kind": "function",
"scope": "global",
"___id": "T000002R000274",
"___s": true,
"filepath": "findLastKey.js"
}