@@ -5,6 +5,8 @@ var isRegex = require('is-regex');
5
5
var flags = require ( 'regexp.prototype.flags' ) ;
6
6
var isArray = require ( 'isarray' ) ;
7
7
var isDate = require ( 'is-date-object' ) ;
8
+ var isBoxedPrimitive = require ( 'is-boxed-primitive' ) ;
9
+ var toPrimitive = require ( 'es-to-primitive/es2015' ) ; // TODO: replace this with ES2020 once updated
8
10
9
11
var getTime = Date . prototype . getTime ;
10
12
var gPO = Object . getPrototypeOf ;
@@ -18,6 +20,12 @@ function deepEqual(actual, expected, options) {
18
20
return true ;
19
21
}
20
22
23
+ var actualBoxed = isBoxedPrimitive ( actual ) ;
24
+ var expectedBoxed = isBoxedPrimitive ( expected ) ;
25
+ if ( actualBoxed || expectedBoxed ) {
26
+ return deepEqual ( toPrimitive ( actual ) , toPrimitive ( expected ) , opts ) ;
27
+ }
28
+
21
29
// 7.3. Other pairs that do not both pass typeof value == 'object', equivalence is determined by ==.
22
30
if ( ! actual || ! expected || ( typeof actual !== 'object' && typeof expected !== 'object' ) ) {
23
31
return opts . strict ? is ( actual , expected ) : actual == expected ;
@@ -53,8 +61,9 @@ function isBuffer(x) {
53
61
}
54
62
55
63
function objEquiv ( a , b , opts ) {
56
- /* eslint max-statements: [2, 70] */
64
+ /* eslint max-statements: [2, 70], max-lines-per-function: [2, 80] */
57
65
var i , key ;
66
+
58
67
if ( typeof a !== typeof b ) { return false ; }
59
68
if ( isUndefinedOrNull ( a ) || isUndefinedOrNull ( b ) ) { return false ; }
60
69
@@ -121,6 +130,7 @@ function objEquiv(a, b, opts) {
121
130
for ( i = ka . length - 1 ; i >= 0 ; i -- ) {
122
131
if ( ka [ i ] != kb [ i ] ) { return false ; }
123
132
}
133
+
124
134
// equivalent values for every corresponding key, and ~~~possibly expensive deep test
125
135
for ( i = ka . length - 1 ; i >= 0 ; i -- ) {
126
136
key = ka [ i ] ;
0 commit comments