MCPcopy
hub / github.com/tdewolff/minify / baseIsEqualDeep

Function baseIsEqualDeep

_benchmarks/sample_victory.js:13719–13762  ·  view source on GitHub ↗

* A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to co

(object, other, bitmask, customizer, equalFunc, stack)

Source from the content-addressed store, hash-verified

13717 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
13718 */
13719function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
13720 var objIsArr = isArray(object),
13721 othIsArr = isArray(other),
13722 objTag = objIsArr ? arrayTag : getTag(object),
13723 othTag = othIsArr ? arrayTag : getTag(other);
13724
13725 objTag = objTag == argsTag ? objectTag : objTag;
13726 othTag = othTag == argsTag ? objectTag : othTag;
13727
13728 var objIsObj = objTag == objectTag,
13729 othIsObj = othTag == objectTag,
13730 isSameTag = objTag == othTag;
13731
13732 if (isSameTag && isBuffer(object)) {
13733 if (!isBuffer(other)) {
13734 return false;
13735 }
13736 objIsArr = true;
13737 objIsObj = false;
13738 }
13739 if (isSameTag && !objIsObj) {
13740 stack || (stack = new Stack);
13741 return (objIsArr || isTypedArray(object))
13742 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
13743 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
13744 }
13745 if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
13746 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
13747 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
13748
13749 if (objIsWrapped || othIsWrapped) {
13750 var objUnwrapped = objIsWrapped ? object.value() : object,
13751 othUnwrapped = othIsWrapped ? other.value() : other;
13752
13753 stack || (stack = new Stack);
13754 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
13755 }
13756 }
13757 if (!isSameTag) {
13758 return false;
13759 }
13760 stack || (stack = new Stack);
13761 return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
13762}
13763
13764module.exports = baseIsEqualDeep;
13765

Callers 1

baseIsEqualFunction · 0.70

Calls 5

isTypedArrayFunction · 0.85
equalByTagFunction · 0.85
isArrayFunction · 0.70
equalArraysFunction · 0.70
equalObjectsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…