@szilanor/stream
    Preparing search index...

    Function groupByRecordAsync

    • Returns a collector that creates a group of entries where the group key is calculated by the selector function.

      Type Parameters

      • T

        Type of items in the source.

      • TKey extends string | number | symbol

        Type of the group key.

      Parameters

      • keySelector: (entry: T) => TKey

        A function that returns the group key for each entry.

      Returns AsyncCollectorFunction<T, Record<TKey, T[]>>

      Collector that creates a group of entries where the group key is calculated by the selector function.

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