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