Finds first entry by iterable value. Expects a map with an iterable as values.
const map = new Map();map.set('hello', 'a');map.set('there', 'b');const entry = firstEntryByPredicate(map, (value, key) => { return (value === 'b');});// Entry is: ['there', 'b'] Copy
const map = new Map();map.set('hello', 'a');map.set('there', 'b');const entry = firstEntryByPredicate(map, (value, key) => { return (value === 'b');});// Entry is: ['there', 'b']
An alternative is firstEntryByValue to search by value.
Map to search
Filter function returns true when there is a match of value
Entry, or undefined if filter function never returns true
filter
Finds first entry by iterable value. Expects a map with an iterable as values.
An alternative is firstEntryByValue to search by value.