1 var getAllKeys = require(
'./_getAllKeys');
4 var COMPARE_PARTIAL_FLAG = 1;
7 var objectProto = Object.prototype;
10 var hasOwnProperty = objectProto.hasOwnProperty;
25 function equalObjects(
object, other, bitmask, customizer, equalFunc, stack) {
26 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
27 objProps = getAllKeys(
object),
28 objLength = objProps.length,
29 othProps = getAllKeys(other),
30 othLength = othProps.length;
32 if (objLength != othLength && !isPartial) {
35 var index = objLength;
37 var key = objProps[index];
38 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
43 var stacked = stack.get(
object);
44 if (stacked && stack.get(other)) {
45 return stacked == other;
48 stack.set(
object, other);
49 stack.set(other,
object);
51 var skipCtor = isPartial;
52 while (++index < objLength) {
53 key = objProps[index];
54 var objValue =
object[key],
55 othValue = other[key];
58 var compared = isPartial
59 ? customizer(othValue, objValue, key, other,
object, stack)
60 : customizer(objValue, othValue, key, object, other, stack);
63 if (!(compared === undefined
64 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
70 skipCtor || (skipCtor = key ==
'constructor');
72 if (result && !skipCtor) {
73 var objCtor =
object.constructor,
74 othCtor = other.constructor;
77 if (objCtor != othCtor &&
78 (
'constructor' in
object &&
'constructor' in other) &&
79 !(typeof objCtor ==
'function' && objCtor instanceof objCtor &&
80 typeof othCtor ==
'function' && othCtor instanceof othCtor)) {
84 stack[
'delete'](object);
85 stack[
'delete'](other);
89 module.exports = equalObjects;