• Groups an array into key accessible groups of objects

    Type Parameters

    • T

    • I = T

    • K extends string | number = string

    Parameters

    • iterable: Iterable<T>

      iterable items to group

    • keySelector: keyof T | ((item) => undefined | K)

      function to get the group by key

    • Optional itemSelector: ((item) => I)
        • (item): I
        • Parameters

          • item: T

          Returns I

    Returns Record<K, I[]>

  • Groups an array into key accessible groups of objects

    Type Parameters

    • T

    • K extends string | number

    • I = T

    Parameters

    • iterable: Iterable<T>

      iterable items to group

    • keySelector: ((item) => Promise<undefined | K>)

      function to get the group by key

        • (item): Promise<undefined | K>
        • Parameters

          • item: T

          Returns Promise<undefined | K>

    • Optional itemSelector: ((item) => I)
        • (item): I
        • Parameters

          • item: T

          Returns I

    Returns Promise<Record<K, I[]>>