MCPcopy Index your code
hub / github.com/microsoft/SandDance / equals

Function equals

docs/app/js/sanddance-app.js:69469–69488  ·  view source on GitHub ↗
(a, b, epsilon)

Source from the content-addressed store, hash-verified

69467 return t * b + (1 - t) * a;
69468}
69469function equals(a, b, epsilon) {
69470 const oldEpsilon = config.EPSILON;
69471 if (epsilon) config.EPSILON = epsilon;
69472 try {
69473 if (a === b) return true;
69474 if (isArray(a) && isArray(b)) {
69475 if (a.length !== b.length) return false;
69476 for(let i = 0; i < a.length; ++i){
69477 if (!equals(a[i], b[i])) return false;
69478 }
69479 return true;
69480 }
69481 if (a && a.equals) return a.equals(b);
69482 if (b && b.equals) return b.equals(a);
69483 if (typeof a === "number" && typeof b === "number") return Math.abs(a - b) <= config.EPSILON * Math.max(1, Math.abs(a), Math.abs(b));
69484 return false;
69485 } finally{
69486 config.EPSILON = oldEpsilon;
69487 }
69488}
69489function exactEquals(a, b) {
69490 if (a === b) return true;
69491 if (a && typeof a === "object" && b && typeof b === "object") {

Callers 4

linkedListFunction · 0.70
filterPointsFunction · 0.70
cureLocalIntersectionsFunction · 0.70
isValidDiagonalFunction · 0.70

Calls 3

isArrayFunction · 0.70
equalsMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected