source: node_modules/es-toolkit/dist/compat/object/findLastKey.mjs

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 437 bytes
Line 
1import { identity } from '../function/identity.mjs';
2import { isObject } from '../predicate/isObject.mjs';
3import { iteratee } from '../util/iteratee.mjs';
4
5function findLastKey(obj, predicate) {
6 if (!isObject(obj)) {
7 return undefined;
8 }
9 const iteratee$1 = iteratee(predicate ?? identity);
10 const keys = Object.keys(obj);
11 return keys.findLast(key => iteratee$1(obj[key], key, obj));
12}
13
14export { findLastKey };
Note: See TracBrowser for help on using the repository browser.