31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
|
var baseIsEqualDeep = require('./_baseIsEqualDeep'),
|
||
|
isObject = require('./isObject'),
|
||
|
isObjectLike = require('./isObjectLike');
|
||
|
|
||
|
/**
|
||
|
* The base implementation of `_.isEqual` which supports partial comparisons
|
||
|
* and tracks traversed objects.
|
||
|
*
|
||
|
* @private
|
||
|
* @param {*} value The value to compare.
|
||
|
* @param {*} other The other value to compare.
|
||
|
* @param {Function} [customizer] The function to customize comparisons.
|
||
|
* @param {boolean} [bitmask] The bitmask of comparison flags.
|
||
|
* The bitmask may be composed of the following flags:
|
||
|
* 1 - Unordered comparison
|
||
|
* 2 - Partial comparison
|
||
|
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
||
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||
|
*/
|
||
|
function baseIsEqual(value, other, customizer, bitmask, stack) {
|
||
|
if (value === other) {
|
||
|
return true;
|
||
|
}
|
||
|
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
|
||
|
return value !== value && other !== other;
|
||
|
}
|
||
|
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
|
||
|
}
|
||
|
|
||
|
module.exports = baseIsEqual;
|