MCPcopy Index your code
hub / github.com/nodejs/node / partialArrayEquiv

Function partialArrayEquiv

lib/internal/util/comparisons.js:945–965  ·  view source on GitHub ↗
(a, b, mode, memos)

Source from the content-addressed store, hash-verified

943}
944
945function partialArrayEquiv(a, b, mode, memos) {
946 let aPos = 0;
947 for (let i = 0; i < b.length; i++) {
948 let isSparse = b[i] === undefined && !hasOwn(b, i);
949 if (isSparse) {
950 return partialSparseArrayEquiv(a, b, mode, memos, aPos, i);
951 }
952 while (!(isSparse = a[aPos] === undefined && !hasOwn(a, aPos)) &&
953 !innerDeepEqual(a[aPos], b[i], mode, memos)) {
954 aPos++;
955 if (aPos > a.length - b.length + i) {
956 return false;
957 }
958 }
959 if (isSparse) {
960 return partialSparseArrayEquiv(a, b, mode, memos, aPos, i);
961 }
962 aPos++;
963 }
964 return true;
965}
966
967function sparseArrayEquiv(a, b, mode, memos, i) {
968 const keysA = ObjectKeys(a);

Callers 1

objEquivFunction · 0.85

Calls 2

partialSparseArrayEquivFunction · 0.85
innerDeepEqualFunction · 0.85

Tested by

no test coverage detected