2016-10-10 03:43:44 +02:00
|
|
|
var baseIsEqualDeep = require('./_baseIsEqualDeep'),
|
|
|
|
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.
|
2016-11-16 01:59:39 +01:00
|
|
|
* @param {boolean} bitmask The bitmask flags.
|
|
|
|
* 1 - Unordered comparison
|
|
|
|
* 2 - Partial comparison
|
2016-10-10 03:43:44 +02:00
|
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
|
|
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
|
|
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
|
|
*/
|
2016-11-16 01:59:39 +01:00
|
|
|
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
2016-10-10 03:43:44 +02:00
|
|
|
if (value === other) {
|
|
|
|
return true;
|
|
|
|
}
|
2017-04-20 03:09:25 +02:00
|
|
|
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
2016-10-10 03:43:44 +02:00
|
|
|
return value !== value && other !== other;
|
|
|
|
}
|
2016-11-16 01:59:39 +01:00
|
|
|
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
2016-10-10 03:43:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = baseIsEqual;
|