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

Function setEquiv

lib/internal/util/comparisons.js:742–775  ·  view source on GitHub ↗
(a, b, mode, memo)

Source from the content-addressed store, hash-verified

740}
741
742function setEquiv(a, b, mode, memo) {
743 // This is a lazily initiated Set of entries which have to be compared
744 // pairwise.
745 let array;
746
747 const iteratorB = b.values();
748 for (const val of iteratorB) {
749 if (!a.has(val)) {
750 if ((typeof val !== 'object' || val === null) &&
751 (mode !== kLoose || !setMightHaveLoosePrim(a, b, val))) {
752 return false;
753 }
754
755 if (array === undefined) {
756 if (a.size < 3) {
757 return compareSmallSets(a, b, val, iteratorB, mode, memo);
758 }
759 array = [];
760 }
761 // If the specified value doesn't exist in the second set it's a object
762 // (or in loose mode: a non-matching primitive). Find the
763 // deep-(mode-)equal element in a set copy to reduce duplicate checks.
764 array.push(val);
765 }
766 }
767
768 if (array === undefined) {
769 return true;
770 }
771 if (mode === kPartial) {
772 return partialObjectSetEquiv(array, a, b, mode, memo);
773 }
774 return setObjectEquiv(array, a, b, mode, memo);
775}
776
777function partialObjectMapEquiv(array, a, b, mode, memo) {
778 let aPos = 0;

Callers 1

objEquivFunction · 0.85

Calls 7

setMightHaveLoosePrimFunction · 0.85
compareSmallSetsFunction · 0.85
partialObjectSetEquivFunction · 0.85
setObjectEquivFunction · 0.85
hasMethod · 0.65
valuesMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…