• Sorts the array anArray according to the comparator aCmpFun using a merge sort (https://en.wikipedia.org/wiki/Merge_sort. The parameter aPickFun tells how to choose the pivot for splitting the array.

    Parameters

    • anArray: any[]

      the array to be sorted

    • aCmpFun: ((a1: any, a2: any) => number)

      a 2-parameter function returning a number n, telling if the 1st parameter is less-than (n < 0), equal (n == 0) or greater than the 2nd (n > 0)

        • (a1, a2): number
        • Parameters

          • a1: any
          • a2: any

          Returns number

    Returns any[]

    a new array with the same elements as anArray but sorted