The type of the elements that the comparator function compares.
A comparator function that takes two arguments of type T and returns a number. The comparator function should return a negative number if the first argument is less than the second, zero if they are equal, and a positive number if the first argument is greater than the second.
const numbers = [1, 2, 3, 4, 5];
const comparator = (a, b) => a - b;
const invertedComparator = invertComparator(comparator);
numbers.sort(invertedComparator); // [5, 4, 3, 2, 1]
Generated using TypeDoc
This function inverts the order of comparison of a sort-comparator function.