Skip to content

Commit 43b1eef

Browse files
committed
[patch] [[Prototype]]s are only compared in strict mode
1 parent 5c3accc commit 43b1eef

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ function objEquiv(a, b, opts) {
104104
if (aIsDate !== bIsDate) { return false; }
105105
if (aIsDate || bIsDate) { // && would work too, because both are true or both false here
106106
if ($getTime(a) !== $getTime(b)) { return false; }
107-
if (opts.strict && gPO && gPO(a) !== gPO(b)) { return false; }
108-
} else if (gPO && gPO(a) !== gPO(b)) { return false; } // non-Dates always compare [[Prototype]]s
107+
}
108+
if (opts.strict && gPO && gPO(a) !== gPO(b)) { return false; }
109109

110110
var aIsBuffer = isBuffer(a);
111111
var bIsBuffer = isBuffer(b);

test/cmp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ test('[[Prototypes]]', { skip: !Object.getPrototypeOf }, function (t) {
422422
var instance = new C();
423423
delete instance.constructor;
424424

425-
t.deepEqualTest({}, instance, 'two identical objects with different [[Prototypes]]', false, false);
425+
t.deepEqualTest({}, instance, 'two identical objects with different [[Prototypes]]', true, false);
426426

427427
t.test('Dates with different prototypes', { skip: !Object.setPrototypeOf }, function (st) {
428428
var d1 = new Date(0);

0 commit comments

Comments
 (0)