Skip to content

Commit 198f473

Browse files
committed
Exit early for IE if we detect a type mismatch
1 parent 31cf2c9 commit 198f473

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

internal/util/comparisons.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,18 @@ function innerDeepEqual(val1, val2, strict, memos) {
204204
}
205205
return keyCheck(val1, val2, strict, memos, kIsArray, keys1);
206206
}
207-
// [browserify] This triggers on certain types in IE (Map/Set)
208-
// if (val1Tag === '[object Object]') {
209-
// return keyCheck(val1, val2, strict, memos, kNoIterator);
210-
// }
207+
// [browserify] This triggers on certain types in IE (Map/Set) so we don't
208+
// wan't to early return out of the rest of the checks. However we can check
209+
// if the second value is one of these values and the first isn't.
210+
if (val1Tag === '[object Object]') {
211+
// return keyCheck(val1, val2, strict, memos, kNoIterator);
212+
if (
213+
(!isMap(val1) && isMap(val2)) ||
214+
(!isSet(val1) && isSet(val2))
215+
) {
216+
return false;
217+
}
218+
}
211219
if (isDate(val1)) {
212220
if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) {
213221
return false;

0 commit comments

Comments
 (0)