KeyCompare: ((left, right) => KeyComparison)

compareKeys implements a partial order over Keys --- it defines relative position between two Keys but leaves some pairs incomparable (for example, subsets over sets is a partial order in which {} precedes {x} and {y}, which are mutually incomparable but both precede {x, y}). As with the rank ordering produced by compareRank, -1, 0, and 1 respectively mean "less than", "equivalent to", and "greater than". NaN means "incomparable" --- the first key is not less, equivalent, or greater than the second.

By using NaN for "incomparable", the normal equivalence for using the return value in a comparison is preserved. compareKeys(left, right) >= 0 iff left is greater than or equivalent to right in the partial ordering.

Key order (a partial order) and rank order (a total preorder) are co-designed to support efficient range search for Key-based queries (@see ../README.md#rank-order-and-key-order).

Type declaration

Generated using TypeDoc