Function groupBy

Group an array of objects by a property in the objects

  • Type Parameters

    • T
    • P

    Parameters

    • list: T[]

      Array of objects

    • getKey: (item: T) => P

      Function which accepts an object and returns a property from it

    Returns Record<string, T[]>[]