Function groupBy

  • Groups the specified items array by the specified property.

    Type Parameters

    • T

      Type of item in the specified items array.

    Parameters

    • items: T[]

      Array of items to group.

    • property: string

      Property of item to group by.

    Returns Dict<T[]>

    Object with key of property and value of values keyed by property.

  • Groups the specified items array by the return value of the specified iteratee.

    Type Parameters

    • T

      Type of item in the specified items array.

    Parameters

    • items: T[]

      Array of items to group.

    • iteratee: Iteratee<T>

      Function that returns the key to group by.

    Returns Dict<T[]>

    Object with key of property and value of values keyed by iteratee.