findKey
Returns the first key of a Map whose entry satisfies the predicate, in insertion order.
Available since v3.0.3
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
map | ReadonlyMap<K, V> | The Map to search |
predicate | function | Function invoked with (value, key) |
Returns
Section titled “Returns”K | undefined — The matching key, or undefined if none matches
Examples
Section titled “Examples”Find the key of the first matching entry
Section titled “Find the key of the first matching entry”Searches in insertion order and returns the key of the first match.
No match
Section titled “No match”Returns undefined when nothing satisfies the predicate.
