* The base implementation of `_.isEqual`, without support for `thisArg` binding, * that allows partial "_.where" style comparisons. * * @private * @param {*} a The value to compare. * @param {*} b The other value to compare. * @param {Function} [callback] The function t
(a, b, callback, isWhere, stackA, stackB)
| 36185 | * @returns {boolean} Returns `true` if the values are equivalent, else `false`. |
| 36186 | */ |
| 36187 | function baseIsEqual(a, b, callback, isWhere, stackA, stackB) { |
| 36188 | // used to indicate that when comparing objects, `a` has at least the properties of `b` |
| 36189 | if (callback) { |
| 36190 | var result = callback(a, b); |
| 36191 | if (typeof result != 'undefined') { |
| 36192 | return !!result; |
| 36193 | } |
| 36194 | } |
| 36195 | // exit early for identical values |
| 36196 | if (a === b) { |
| 36197 | // treat `+0` vs. `-0` as not equal |
| 36198 | return a !== 0 || (1 / a == 1 / b); |
| 36199 | } |
| 36200 | var type = typeof a, |
| 36201 | otherType = typeof b; |
| 36202 | |
| 36203 | // exit early for unlike primitive values |
| 36204 | if (a === a && |
| 36205 | !(a && objectTypes[type]) && |
| 36206 | !(b && objectTypes[otherType])) { |
| 36207 | return false; |
| 36208 | } |
| 36209 | // exit early for `null` and `undefined` avoiding ES3's Function#call behavior |
| 36210 | // http://es5.github.io/#x15.3.4.4 |
| 36211 | if (a == null || b == null) { |
| 36212 | return a === b; |
| 36213 | } |
| 36214 | // compare [[Class]] names |
| 36215 | var className = toString.call(a), |
| 36216 | otherClass = toString.call(b); |
| 36217 | |
| 36218 | if (className == argsClass) { |
| 36219 | className = objectClass; |
| 36220 | } |
| 36221 | if (otherClass == argsClass) { |
| 36222 | otherClass = objectClass; |
| 36223 | } |
| 36224 | if (className != otherClass) { |
| 36225 | return false; |
| 36226 | } |
| 36227 | switch (className) { |
| 36228 | case boolClass: |
| 36229 | case dateClass: |
| 36230 | // coerce dates and booleans to numbers, dates to milliseconds and booleans |
| 36231 | // to `1` or `0` treating invalid dates coerced to `NaN` as not equal |
| 36232 | return +a == +b; |
| 36233 | |
| 36234 | case numberClass: |
| 36235 | // treat `NaN` vs. `NaN` as equal |
| 36236 | return (a != +a) |
| 36237 | ? b != +b |
| 36238 | // but treat `+0` vs. `-0` as not equal |
| 36239 | : (a == 0 ? (1 / a == 1 / b) : a == +b); |
| 36240 | |
| 36241 | case regexpClass: |
| 36242 | case stringClass: |
| 36243 | // coerce regexes to strings (http://es5.github.io/#x15.10.6.4) |
| 36244 | // treat string primitives and their corresponding object instances as equal |
no test coverage detected