Skip to content

createComparator

createComparator<T>(precedes): Comparator<T>

Defined in: packages/core/src/function/compare/create-comparator.ts:12

Adapts an OrderPredicate into a Comparator.

Costs two predicate calls per comparison to synthesise the equivalent case — neither a precedes b nor b precedes a. Write a comparator directly rather than deriving one for a hot loop.

T

OrderPredicate<T>

Comparator<T>