• Compare two values in descending order using JavaScript's built in comparison operators.

    Type Parameters

    • T

    Parameters

    • a: T

      The left comparison value.

    • b: T

      The right comparison value.

    Returns -1 | 0 | 1

    -1 if a is greater than b, 0 if a is equal to b, and 1 if a is less than b.

    import { descend } from "@std/data-structures";
    import { assertEquals } from "@std/assert";

    assertEquals(descend(1, 2), 1);
    assertEquals(descend(2, 1), -1);
    assertEquals(descend(1, 1), 0);

    T The type of the values being compared.