iter-fns - v0.13.0
    Preparing search index...

    Function sort

    • Sorts an array in place.

      This sort is stable, as it calls Array.prototype.sort under the hood which is guaranteed to be stable from ECMAScript 2019 onwards.

      If you are using a comparator that computes a key for each item that is expensive, consider using sortOn which will compute all the keys up front before sorting.

      Note that this differs from Array.prototype.sort in that it will sort numbers correctly by default.

      Type Parameters

      • T

        type of the item

      Parameters

      • xs: T[]

        the array

      • cmp: Compare<T> = compare

        the comparator

      Returns void