Cleanup baseIsEqualDeep.

This commit is contained in:
John-David Dalton
2015-01-14 22:27:54 -08:00
committed by jdalton
parent 28560cb887
commit 53ea73238a

View File

@@ -2287,24 +2287,32 @@
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/ */
function baseIsEqualDeep(object, other, equalFunc, customizer, isWhere, stackA, stackB) { function baseIsEqualDeep(object, other, equalFunc, customizer, isWhere, stackA, stackB) {
var objTag = isArray(object) ? arrayTag : objToString.call(object), var objIsArr = isArray(object),
objIsArg = objTag == argsTag, othIsArr = isArray(other),
objIsArr = !objIsArg && arrayLikeTags[objTag], objTag = arrayTag,
othTag = isArray(other) ? arrayTag : objToString.call(other), othTag = arrayTag;
othIsArg = othTag == argsTag,
othIsArr = !othIsArg && arrayLikeTags[othTag];
if (!lodash.support.argsTag) { if (!objIsArr) {
objIsArg = !objIsArr && typeof object.length == 'number' && isArguments(object); objTag = objToString.call(object);
othIsArg = !othIsArr && typeof other.length == 'number' && isArguments(other); if (typeof object.length == 'number') {
if (isArguments(object)) {
object = arrayToObject(object);
objTag = objectTag;
} else if (objTag != objectTag) {
objIsArr = isTypedArray(object);
}
}
} }
if (objIsArg) { if (!othIsArr) {
object = argsToObject(object); othTag = objToString.call(other);
objTag = objectTag; if (typeof other.length == 'number') {
} if (isArguments(other)) {
if (othIsArg) { other = arrayToObject(other);
other = argsToObject(other); othTag = objectTag;
othTag = objectTag; } else if (othTag != objectTag) {
othIsArr = isTypedArray(other);
}
}
} }
var objIsObj = objTag == objectTag && !isHostObject(object), var objIsObj = objTag == objectTag && !isHostObject(object),
othIsObj = othTag == objectTag && !isHostObject(other), othIsObj = othTag == objectTag && !isHostObject(other),