Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandTyp
case 'Number':
case 'Boolean':
case 'Date':
case 'BigInt':
// If these types are their instance types (e.g. `new Number`) then re-deepEqual against their values
return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf());
case 'Promise':
Expand Down
25 changes: 25 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,31 @@ describe('Generic', function () {

});

describe('BigInt', function () {

it('returns true for same values', function () {
assert(eql(BigInt(1), BigInt(1)), 'eql(BigInt(1), BigInt(1))');
assert(eql(Object(BigInt(1)), Object(BigInt(1))), 'eql(Object(BigInt(1)), Object(BigInt(1)))');
});

it('returns false for literal vs instance with same value', function () {
assert(eql(BigInt(1), Object(BigInt(1))) === false, 'eql(BigInt(1), Object(BigInt(1))) === false');
});

it('returns false on numbers with different signs', function () {
assert(eql(BigInt(-1), BigInt(1)) === false, 'eql(BigInt(-1), BigInt(1)) === false');
});

it('returns false on instances with different signs', function () {
assert(eql(Object(BigInt(-1)), Object(BigInt(1))) === false, 'eql(Object(BigInt(-1)), Object(BigInt(1))) === false');
});

it('returns false for literal vs number with same value', function () {
assert(eql(BigInt(1), 1) === false, 'eql(BigInt(1), 1) === false');
});

});

describe('dates', function () {

it('returns true given two dates with the same time', function () {
Expand Down
Loading