Skip to content

Commit

Permalink
[Fix] the prototype property is not special on non-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Mar 6, 2020
1 parent 7ccb2b0 commit 1c3cc25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 0 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,6 @@ function objEquiv(a, b, opts, channel) {
if (typeof a !== typeof b) { return false; }
if (a == null || b == null) { return false; }

// an identical 'prototype' property.
if (a.prototype !== b.prototype) { return false; }

if ($objToString(a) !== $objToString(b)) { return false; }

if (isArguments(a) !== isArguments(b)) { return false; }
Expand Down
12 changes: 12 additions & 0 deletions test/cmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,18 @@ test('regexen', function (t) {
t.end();
});

test('object literals', function (t) {
t.deepEqualTest(
{ prototype: 2 },
{ prototype: '2' },
'two loosely equal, strictly inequal prototype properties',
true,
false
);

t.end();
});

test('arrays and objects', function (t) {
t.deepEqualTest([], {}, 'empty array and empty object', false, false);
t.deepEqualTest([], { length: 0 }, 'empty array and empty arraylike object', false, false);
Expand Down

0 comments on commit 1c3cc25

Please sign in to comment.