/object/findKey
stdSearches the given object by the given predicate and returns the found key or undefined.
Type signature
(
predicate: (value: any, key: string, context: object) => boolean
) => (xs: object) => any
Examples
findKey(({ x }) => x % 2 === 0)({
a: { x: 1 },
b: { x: 2 },
c: { x: 3 },
});
// ⇒ "b"
Try in REPL
Questions
- How to find a key of an object by a predicate function?