* Generate an augmented comparator function that provides stable * sorting by tuple id when the given comparator produces ties. * @param {function} cmp - The comparator to augment. * @param {function} [f] - Optional tuple accessor function. * @return {function} An augmented comparator function.
(cmp, f)
| 76631 | |
| 76632 | |
| 76633 | function stableCompare(cmp, f) { |
| 76634 | return !cmp ? null : f ? (a, b) => cmp(a, b) || tupleid(f(a)) - tupleid(f(b)) : (a, b) => cmp(a, b) || tupleid(a) - tupleid(b); |
| 76635 | } |
| 76636 | },{}],"m0dW":[function(require,module,exports) { |
| 76637 | "use strict"; |
| 76638 |