Cleanup error object fork in baseIsEqual.

This commit is contained in:
John-David Dalton
2014-07-03 12:26:47 -07:00
parent 79d59ff9ca
commit 0a7fc6c48c

View File

@@ -1964,21 +1964,23 @@
valIsArg = isArguments(value); valIsArg = isArguments(value);
othIsArg = isArguments(other); othIsArg = isArguments(other);
} }
var hasValCtor = !valIsArg && hasOwnProperty.call(value, 'constructor'),
hasOthCtor = !othIsArg && hasOwnProperty.call(other, 'constructor');
if (hasValCtor != hasOthCtor) {
return false;
}
if (!hasValCtor) {
// in older versions of Opera, `arguments` objects have `Array` constructors // in older versions of Opera, `arguments` objects have `Array` constructors
var valCtor = valIsArg ? Object : value.constructor, var valCtor = valIsArg ? Object : value.constructor,
othCtor = othIsArg ? Object : other.constructor; othCtor = othIsArg ? Object : other.constructor;
if (isErr) {
// error objects of different types are not equal // error objects of different types are not equal
if (isErr && valCtor.prototype.name != othCtor.prototype.name) { if (valCtor.prototype.name != othCtor.prototype.name) {
return false; return false;
} }
} else {
var valHasCtor = !valIsArg && hasOwnProperty.call(value, 'constructor'),
othHasCtor = !othIsArg && hasOwnProperty.call(other, 'constructor');
if (valHasCtor != othHasCtor) {
return false;
}
if (!valHasCtor) {
// 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 &&
!(isFunction(valCtor) && valCtor instanceof valCtor && isFunction(othCtor) && othCtor instanceof othCtor) && !(isFunction(valCtor) && valCtor instanceof valCtor && isFunction(othCtor) && othCtor instanceof othCtor) &&
@@ -1987,6 +1989,7 @@
return false; return false;
} }
} }
}
var valProps = isErr ? ['message', 'name'] : keys(value), var valProps = isErr ? ['message', 'name'] : keys(value),
othProps = isErr ? valProps : keys(other); othProps = isErr ? valProps : keys(other);