MCPcopy Create free account
hub / github.com/breck7/scroll / compareDefined

Function compareDefined

external/.d3.js:566–574  ·  view source on GitHub ↗
(compare = ascending$3)

Source from the content-addressed store, hash-verified

564}
565
566function compareDefined(compare = ascending$3) {
567 if (compare === ascending$3) return ascendingDefined;
568 if (typeof compare !== "function") throw new TypeError("compare is not a function");
569 return (a, b) => {
570 const x = compare(a, b);
571 if (x || x === 0) return x;
572 return (compare(b, b) === 0) - (compare(a, a) === 0);
573 };
574}
575
576function ascendingDefined(a, b) {
577 return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);

Callers 3

sortFunction · 0.85
quickselectFunction · 0.85
rankFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected