Function numericDesc

  • For use with sorting functions such as sortWith or the built-in Array.prototype.sort(). Sorts in descending numerical order, with NaN last.

    Example

    import * as A from "flurp/array";
    import * as C from "flurp/comparator";

    const sortNumbers = A.sortWith(C.numericDesc);
    sortNumbers([30, 6, 1, NaN, 200, 5]); // [200, 30, 6, 5, 1, NaN]

    Parameters

    • x: number
    • y: number

    Returns 0 | 1 | -1