mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Fix baseIsEqual in Rhino, Ringo, Narwhal.
This commit is contained in:
22
lodash.js
22
lodash.js
@@ -1579,12 +1579,14 @@
|
|||||||
}
|
}
|
||||||
// compare [[Class]] names
|
// compare [[Class]] names
|
||||||
var valClass = toString.call(value),
|
var valClass = toString.call(value),
|
||||||
othClass = toString.call(other);
|
othClass = toString.call(other),
|
||||||
|
valIsArg = valClass == argsClass,
|
||||||
|
othIsArg = othClass == argsClass;
|
||||||
|
|
||||||
if (valClass == argsClass) {
|
if (valIsArg) {
|
||||||
valClass = objectClass;
|
valClass = objectClass;
|
||||||
}
|
}
|
||||||
if (othClass == argsClass) {
|
if (othIsArg) {
|
||||||
othClass = objectClass;
|
othClass = objectClass;
|
||||||
}
|
}
|
||||||
if (valClass != othClass) {
|
if (valClass != othClass) {
|
||||||
@@ -1623,16 +1625,20 @@
|
|||||||
if (valClass != objectClass || (!support.nodeClass && (isNode(value) || isNode(other)))) {
|
if (valClass != objectClass || (!support.nodeClass && (isNode(value) || isNode(other)))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var hasValCtor = hasOwnProperty.call(value, 'constructor'),
|
if (!support.argsObject) {
|
||||||
hasOthCtor = hasOwnProperty.call(other, 'constructor');
|
valIsArg = isArguments(value);
|
||||||
|
othIsArg = isArguments(other);
|
||||||
|
}
|
||||||
|
var hasValCtor = !valIsArg && hasOwnProperty.call(value, 'constructor'),
|
||||||
|
hasOthCtor = !othIsArg && hasOwnProperty.call(other, 'constructor');
|
||||||
|
|
||||||
if (hasValCtor !== hasOthCtor) {
|
if (hasValCtor != hasOthCtor) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!hasValCtor) {
|
if (!hasValCtor) {
|
||||||
// in older versions of Opera, `arguments` objects have `Array` constructors
|
// in older versions of Opera, `arguments` objects have `Array` constructors
|
||||||
var valCtor = !support.argsObject && isArguments(value) ? Object : value.constructor,
|
var valCtor = valIsArg ? Object : value.constructor,
|
||||||
othCtor = !support.argsObject && isArguments(other) ? Object : other.constructor;
|
othCtor = othIsArg ? Object : other.constructor;
|
||||||
|
|
||||||
// non `Object` object instances with different constructors are not equal
|
// non `Object` object instances with different constructors are not equal
|
||||||
if (valCtor != othCtor &&
|
if (valCtor != othCtor &&
|
||||||
|
|||||||
Reference in New Issue
Block a user