• groups array elements through a comparator function

    Type Parameters

    • T

    Parameters

    • data: readonly T[]

      array of elements to group

    • compare: ((a, b) => number)

      comparator function: return of 0 means should group, anything above means not group

        • (a, b): number
        • Parameters

          Returns number

    Returns T[][]

    array of arrays with grouped elements