@rimbu/sorted
Version:
Immutable SortedMap and SortedSet implementations for TypeScript
21 lines • 632 B
JavaScript
export var SortedIndex;
(function (SortedIndex) {
function next(index) {
return index >= 0 ? -index - 2 : -index - 1;
}
SortedIndex.next = next;
function prev(index) {
return index >= 0 ? -index - 1 : -index - 2;
}
SortedIndex.prev = prev;
SortedIndex.firstChild = -1;
function compare(i1, i2) {
if (Object.is(i1, i2))
return 0;
const v1 = i1 >= 0 ? i1 : -i1 - 1.5;
const v2 = i2 >= 0 ? i2 : -i2 - 1.5;
return v1 - v2;
}
SortedIndex.compare = compare;
})(SortedIndex || (SortedIndex = {}));
//# sourceMappingURL=sorted-index.mjs.map