RankCompare: ((left: any, right: any) => RankComparison)

Returns -1, 0, or 1 depending on whether the rank of left is respectively before, tied-with, or after the rank of right.

As a total preorder, this comparison function is valid as an argument to Array.prototype.sort but may return 0 to indicate that two distinguishable elements such as -0 and 0 are tied (i.e., are in the same equivalence class for the purposes of this ordering). If each such equivalence class is a rank and ranks are disjoint, then this "rank order" is a true total order over these ranks.

This function establishes a total rank order over all passables. To do so it makes arbitrary choices, such as that all strings are after all numbers, and thus is not intended to be used directly as a comparison with useful semantics. However, it must be closely enough related to such comparisons to aid in implementing lookups based on those comparisons. For example, in order to get a total order over ranks, we put NaN after all other JavaScript "number" values (i.e., IEEE 754 floating-point values) but otherwise rank JavaScript numbers by signed magnitude, with 0 and -0 tied, as would a semantically useful ordering such as KeyCompare in ../../patterns. Likewise, an array sorted by rank would enable range queries by magnitude.