fc22dc4cd05096f179221a89d529e05679268855
[platform/framework/web/crosswalk-tizen.git] /
1 var baseIsEqualDeep = require('./baseIsEqualDeep');
2
3 /**
4  * The base implementation of `_.isEqual` without support for `this` binding
5  * `customizer` functions.
6  *
7  * @private
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`.
15  */
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);
21   }
22   var valType = typeof value,
23       othType = typeof other;
24
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;
30   }
31   return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
32 }
33
34 module.exports = baseIsEqual;