descend
import { descend } from "jsr:@ende/data-structures";function
function descend<T>(a: T, b: T): -1 | 0 | 1Compare two values in descending order using JavaScript's built in comparison operators.
a: TThe left comparison value.
b: TThe right comparison value.
Returns
-1 if a is greater than b, 0 if a is equal to b, and 1 if a is less than b.
Example: Comparing numbers
import { descend } from "@ende/data-structures";
import { assertEquals } from "@ende/assert";
assertEquals(descend(1, 2), 1);
assertEquals(descend(2, 1), -1);
assertEquals(descend(1, 1), 0);