|
import Stack from './_Stack.js'; |
|
import equalArrays from './_equalArrays.js'; |
|
import equalByTag from './_equalByTag.js'; |
|
import equalObjects from './_equalObjects.js'; |
|
import getTag from './_getTag.js'; |
|
import isArray from './isArray.js'; |
|
import isBuffer from './isBuffer.js'; |
|
import isTypedArray from './isTypedArray.js'; |
|
|
|
|
|
var COMPARE_PARTIAL_FLAG = 1; |
|
|
|
|
|
var argsTag = '[object Arguments]', |
|
arrayTag = '[object Array]', |
|
objectTag = '[object Object]'; |
|
|
|
|
|
var objectProto = Object.prototype; |
|
|
|
|
|
var hasOwnProperty = objectProto.hasOwnProperty; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { |
|
var objIsArr = isArray(object), |
|
othIsArr = isArray(other), |
|
objTag = objIsArr ? arrayTag : getTag(object), |
|
othTag = othIsArr ? arrayTag : getTag(other); |
|
|
|
objTag = objTag == argsTag ? objectTag : objTag; |
|
othTag = othTag == argsTag ? objectTag : othTag; |
|
|
|
var objIsObj = objTag == objectTag, |
|
othIsObj = othTag == objectTag, |
|
isSameTag = objTag == othTag; |
|
|
|
if (isSameTag && isBuffer(object)) { |
|
if (!isBuffer(other)) { |
|
return false; |
|
} |
|
objIsArr = true; |
|
objIsObj = false; |
|
} |
|
if (isSameTag && !objIsObj) { |
|
stack || (stack = new Stack); |
|
return (objIsArr || isTypedArray(object)) |
|
? equalArrays(object, other, bitmask, customizer, equalFunc, stack) |
|
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); |
|
} |
|
if (!(bitmask & COMPARE_PARTIAL_FLAG)) { |
|
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), |
|
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); |
|
|
|
if (objIsWrapped || othIsWrapped) { |
|
var objUnwrapped = objIsWrapped ? object.value() : object, |
|
othUnwrapped = othIsWrapped ? other.value() : other; |
|
|
|
stack || (stack = new Stack); |
|
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); |
|
} |
|
} |
|
if (!isSameTag) { |
|
return false; |
|
} |
|
stack || (stack = new Stack); |
|
return equalObjects(object, other, bitmask, customizer, equalFunc, stack); |
|
} |
|
|
|
export default baseIsEqualDeep; |
|
|