Function groupSort

  • Groups the specified iterable of elements according to the specified key function, sorts the groups according to the specified comparator, and then returns an array of keys in sorted order. The comparator will be asked to compare two groups a and b and should return a negative value if a should be before b, a positive value if a should be after b, or zero for a partial ordering.

    Type Parameters

    • TObject

    • TKey

    Parameters

    • iterable: Iterable<TObject>
    • comparator: ((a, b) => number)
        • (a, b): number
        • Parameters

          • a: TObject[]
          • b: TObject[]

          Returns number

    • key: ((value) => TKey)
        • (value): TKey
        • Parameters

          • value: TObject

          Returns TKey

    Returns TKey[]

  • Groups the specified iterable of elements according to the specified key function, sorts the groups according to the specified accessor, and then returns an array of keys in sorted order.

    Type Parameters

    • TObject

    • TKey

    Parameters

    • iterable: Iterable<TObject>
    • accessor: ((value) => unknown)
        • (value): unknown
        • Parameters

          • value: TObject[]

          Returns unknown

    • key: ((value) => TKey)
        • (value): TKey
        • Parameters

          • value: TObject

          Returns TKey

    Returns TKey[]