Skip to content

Commit

Permalink
[patch] [[Prototype]]s are only compared in strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 30, 2019
1 parent 5c3accc commit 43b1eef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ function objEquiv(a, b, opts) {
if (aIsDate !== bIsDate) { return false; }
if (aIsDate || bIsDate) { // && would work too, because both are true or both false here
if ($getTime(a) !== $getTime(b)) { return false; }
if (opts.strict && gPO && gPO(a) !== gPO(b)) { return false; }
} else if (gPO && gPO(a) !== gPO(b)) { return false; } // non-Dates always compare [[Prototype]]s
}
if (opts.strict && gPO && gPO(a) !== gPO(b)) { return false; }

var aIsBuffer = isBuffer(a);
var bIsBuffer = isBuffer(b);
Expand Down
2 changes: 1 addition & 1 deletion test/cmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ test('[[Prototypes]]', { skip: !Object.getPrototypeOf }, function (t) {
var instance = new C();
delete instance.constructor;

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

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

0 comments on commit 43b1eef

Please sign in to comment.