• Function that compares two items for sorting (ascending).

    Example

    compare("a", "b") // -1
    compare("a", "a") // 0
    compare(1, 2) // -1
    [3, 2, 4, 1].sort(compare) // [1, 2, 3, 4]

    Type Parameters

    • T

    Parameters

    • a: T
    • b: T

    Returns number

Generated using TypeDoc