1 var baseIsEqualDeep = require('./baseIsEqualDeep');
4 * The base implementation of `_.isEqual` without support for `this` binding
5 * `customizer` functions.
8 * @param {*} value The value to compare.
9 * @param {*} other The other value to compare.
10 * @param {Function} [customizer] The function to customize comparing values.
11 * @param {boolean} [isLoose] Specify performing partial comparisons.
12 * @param {Array} [stackA] Tracks traversed `value` objects.
13 * @param {Array} [stackB] Tracks traversed `other` objects.
14 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
16 function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
17 // Exit early for identical values.
18 if (value === other) {
19 // Treat `+0` vs. `-0` as not equal.
20 return value !== 0 || (1 / value == 1 / other);
22 var valType = typeof value,
23 othType = typeof other;
25 // Exit early for unlike primitive values.
26 if ((valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object') ||
27 value == null || other == null) {
28 // Return `false` unless both values are `NaN`.
29 return value !== value && other !== other;
31 return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
34 module.exports = baseIsEqual;