ixfx
    Preparing search index...

    Function firstEntry

    • Finds first entry by iterable value. Expects a map with an iterable as values.

      const map = new Map();
      map.set('hello', ['a', 'b', 'c']);
      map.set('there', ['d', 'e', 'f']);

      const entry = firstEntry(map, (value, key) => {
      return (value === 'e');
      });
      // Entry is: ['there', ['d', 'e', 'f']]

      An alternative is firstEntryByValue to search by value.

      Type Parameters

      • K
      • V

      Parameters

      • map: Data.Maps.IWithEntries<K, Iterable<V, any, any>>

        Map to search

      • predicate: (value: V, key: K) => boolean

        Filter function returns true when there is a match of value

      Returns undefined | readonly [K, Iterable<V, any, any>]

      Entry, or undefined if filter function never returns true