* A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `base
(object, other, bitmask, customizer, equalFunc, stack)
| 5861 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
| 5862 | */ |
| 5863 | function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { |
| 5864 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG, |
| 5865 | objProps = getAllKeys(object), |
| 5866 | objLength = objProps.length, |
| 5867 | othProps = getAllKeys(other), |
| 5868 | othLength = othProps.length; |
| 5869 | |
| 5870 | if (objLength != othLength && !isPartial) { |
| 5871 | return false; |
| 5872 | } |
| 5873 | var index = objLength; |
| 5874 | while (index--) { |
| 5875 | var key = objProps[index]; |
| 5876 | if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { |
| 5877 | return false; |
| 5878 | } |
| 5879 | } |
| 5880 | // Check that cyclic values are equal. |
| 5881 | var objStacked = stack.get(object); |
| 5882 | var othStacked = stack.get(other); |
| 5883 | if (objStacked && othStacked) { |
| 5884 | return objStacked == other && othStacked == object; |
| 5885 | } |
| 5886 | var result = true; |
| 5887 | stack.set(object, other); |
| 5888 | stack.set(other, object); |
| 5889 | |
| 5890 | var skipCtor = isPartial; |
| 5891 | while (++index < objLength) { |
| 5892 | key = objProps[index]; |
| 5893 | var objValue = object[key], |
| 5894 | othValue = other[key]; |
| 5895 | |
| 5896 | if (customizer) { |
| 5897 | var compared = isPartial |
| 5898 | ? customizer(othValue, objValue, key, other, object, stack) |
| 5899 | : customizer(objValue, othValue, key, object, other, stack); |
| 5900 | } |
| 5901 | // Recursively compare objects (susceptible to call stack limits). |
| 5902 | if (!(compared === undefined |
| 5903 | ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) |
| 5904 | : compared |
| 5905 | )) { |
| 5906 | result = false; |
| 5907 | break; |
| 5908 | } |
| 5909 | skipCtor || (skipCtor = key == 'constructor'); |
| 5910 | } |
| 5911 | if (result && !skipCtor) { |
| 5912 | var objCtor = object.constructor, |
| 5913 | othCtor = other.constructor; |
| 5914 | |
| 5915 | // Non `Object` object instances with different constructors are not equal. |
| 5916 | if (objCtor != othCtor && |
| 5917 | ('constructor' in object && 'constructor' in other) && |
| 5918 | !(typeof objCtor == 'function' && objCtor instanceof objCtor && |
| 5919 | typeof othCtor == 'function' && othCtor instanceof othCtor)) { |
| 5920 | result = false; |
no test coverage detected