mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
Simplify equalObjects.
This commit is contained in:
24
lodash.js
24
lodash.js
@@ -3251,8 +3251,7 @@
|
||||
if (objLength != othLength && !isWhere) {
|
||||
return false;
|
||||
}
|
||||
var objHasCtor,
|
||||
othHasCtor,
|
||||
var hasCtor,
|
||||
index = -1;
|
||||
|
||||
while (++index < objLength) {
|
||||
@@ -3271,20 +3270,17 @@
|
||||
if (!result) {
|
||||
return result;
|
||||
}
|
||||
objHasCtor || (objHasCtor = key == 'constructor');
|
||||
othHasCtor || (othHasCtor = key == 'constructor');
|
||||
hasCtor || (hasCtor = key == 'constructor');
|
||||
}
|
||||
if (objHasCtor != othHasCtor) {
|
||||
return false;
|
||||
}
|
||||
// In older versions of Opera, `arguments` objects have `Array` constructors.
|
||||
var objCtor = object.constructor,
|
||||
othCtor = other.constructor;
|
||||
if (!hasCtor) {
|
||||
var objCtor = object.constructor,
|
||||
othCtor = other.constructor;
|
||||
|
||||
// Non `Object` object instances with different constructors are not equal.
|
||||
if (!objHasCtor && objCtor != othCtor && ('constructor' in object && 'constructor' in other) &&
|
||||
!(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
||||
return false;
|
||||
// Non `Object` object instances with different constructors are not equal.
|
||||
if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) &&
|
||||
!(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user