mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Simplify type checks in _.isEqual.
Former-commit-id: a1aeb5aeab6ef30c6f9377f5498da4eb6d112bc3
This commit is contained in:
6
build.js
6
build.js
@@ -266,7 +266,7 @@
|
|||||||
'escapeHtmlChar': ['htmlEscapes'],
|
'escapeHtmlChar': ['htmlEscapes'],
|
||||||
'htmlUnescapes': ['htmlEscapes'],
|
'htmlUnescapes': ['htmlEscapes'],
|
||||||
'isArray': ['reNative'],
|
'isArray': ['reNative'],
|
||||||
'isEqual': ['indicatorObject'],
|
'isEqual': ['indicatorObject', 'objectTypes'],
|
||||||
'isObject': ['objectTypes'],
|
'isObject': ['objectTypes'],
|
||||||
'isPlainObject': ['reNative'],
|
'isPlainObject': ['reNative'],
|
||||||
'isRegExp': ['objectTypes'],
|
'isRegExp': ['objectTypes'],
|
||||||
@@ -3320,8 +3320,8 @@
|
|||||||
' otherType = typeof b;',
|
' otherType = typeof b;',
|
||||||
'',
|
'',
|
||||||
' if (a === a &&',
|
' if (a === a &&',
|
||||||
" (!a || (type != 'function' && type != 'object')) &&",
|
" !(a && objectTypes[type]) &&",
|
||||||
" (!b || (otherType != 'function' && otherType != 'object'))) {",
|
" !(b && objectTypes[otherType])) {",
|
||||||
' return false;',
|
' return false;',
|
||||||
' }',
|
' }',
|
||||||
' if (a == null || b == null) {',
|
' if (a == null || b == null) {',
|
||||||
|
|||||||
@@ -1934,8 +1934,8 @@
|
|||||||
|
|
||||||
// exit early for unlike primitive values
|
// exit early for unlike primitive values
|
||||||
if (a === a &&
|
if (a === a &&
|
||||||
(!a || (type != 'function' && type != 'object')) &&
|
!(a && objectTypes[type]) &&
|
||||||
(!b || (otherType != 'function' && otherType != 'object'))) {
|
!(b && objectTypes[otherType])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// exit early for `null` and `undefined`, avoiding ES3's Function#call behavior
|
// exit early for `null` and `undefined`, avoiding ES3's Function#call behavior
|
||||||
|
|||||||
Reference in New Issue
Block a user