@szilanor/stream
    Preparing search index...

    Function toMapAsync

    • Returns a collector that returns a Map from an Iterable.

      Type Parameters

      • T

        Type of items in the source.

      • TKey

        Type of the key.

      • TValue

        Type of the value.

      Parameters

      • keySelector: (entry: T) => TKey

        A function that defines the key for each entry.

      • valueSelector: (entry: T) => TValue

        A function that defines the value for each entry.

      Returns AsyncCollectorFunction<T, Map<TKey, TValue>>

      Collector that returns a Map from an Iterable.

      const result = toMapAsync((x) => x, (x) => x)([1, 2, 3]);
      console.log(result); // Map {1 => 1, 2 => 2, 3 => 3}