Function firstEntryByValue

Finds first entry by value.

const map = new Map();
map.set('hello', 'a');
map.set('there', 'b');

const entry = firstEntryByValue(map, 'b');
// Entry is: ['there', 'b']

An alternative is firstEntryByValue to search by predicate function.

  • Type Parameters

    • K
    • V

    Parameters

    • map: IWithEntries<K, V>

      Map to search

    • value: V

      Value to seek

    • isEqual: IsEqual<V> = isEqualDefault

      Filter function which checks equality. Uses JS comparer by default.

    Returns undefined | readonly [K, V]

    Entry, or undefined if value not found.