Comparer
A type that represents a function which compares two values and returns 1
, 0
, or -1
(minus one).
For more information, refer to the composeSortDescriptors
configuration.
const isGreaterThan: Comparer = (a, b) => a > b ? 1 : -1;
isGreaterThan(42, 42); // 0
isGreaterThan(22, 42); // -1
isGreaterThan(42, 22); // 1