Skip to content

Commit

Permalink
Maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
Xotic750 committed Jan 31, 2020
1 parent 75872ad commit 7b48182
Show file tree
Hide file tree
Showing 10 changed files with 6,180 additions and 2,331 deletions.
183 changes: 167 additions & 16 deletions __tests__/is-deep-strict-equal-x.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ describe('isDeepStrictEqual', function() {

it('regex', function() {
expect.assertions(1);
/* eslint-disable-next-line prefer-regex-literals */
const re1 = new RegExp('test');
const re2 = new MyRegExp('test');

Expand Down Expand Up @@ -118,7 +119,16 @@ describe('isDeepStrictEqual', function() {
notUtilIsDeepStrict(new Set([1, 2, 3]), new Set([1, 2, 3, 4]));
notUtilIsDeepStrict(new Set([1, 2, 3, 4]), new Set([1, 2, 3]));
utilIsDeepStrict(new Set(['1', '2', '3']), new Set(['1', '2', '3']));
utilIsDeepStrict(new Set([[1, 2], [3, 4]]), new Set([[3, 4], [1, 2]]));
utilIsDeepStrict(
new Set([
[1, 2],
[3, 4],
]),
new Set([
[3, 4],
[1, 2],
]),
);

{
const a = [1, 2];
Expand All @@ -129,10 +139,46 @@ describe('isDeepStrictEqual', function() {
utilIsDeepStrict({a, b, s: new Set([a, b])}, {a: c, b: d, s: new Set([d, c])});
}

utilIsDeepStrict(new Map([[1, 1], [2, 2]]), new Map([[1, 1], [2, 2]]));
utilIsDeepStrict(new Map([[1, 1], [2, 2]]), new Map([[2, 2], [1, 1]]));
notUtilIsDeepStrict(new Map([[1, 1], [2, 2]]), new Map([[1, 2], [2, 1]]));
notUtilIsDeepStrict(new Map([[[1], 1], [{}, 2]]), new Map([[[1], 2], [{}, 1]]));
utilIsDeepStrict(
new Map([
[1, 1],
[2, 2],
]),
new Map([
[1, 1],
[2, 2],
]),
);
utilIsDeepStrict(
new Map([
[1, 1],
[2, 2],
]),
new Map([
[2, 2],
[1, 1],
]),
);
notUtilIsDeepStrict(
new Map([
[1, 1],
[2, 2],
]),
new Map([
[1, 2],
[2, 1],
]),
);
notUtilIsDeepStrict(
new Map([
[[1], 1],
[{}, 2],
]),
new Map([
[[1], 2],
[{}, 1],
]),
);

notUtilIsDeepStrict(new Set([1]), [1]);
notUtilIsDeepStrict(new Set(), []);
Expand All @@ -153,33 +199,138 @@ describe('isDeepStrictEqual', function() {
// Ref: https://github.com/nodejs/node/issues/13347
notUtilIsDeepStrict(new Set([{a: 1}, {a: 1}]), new Set([{a: 1}, {a: 2}]));
notUtilIsDeepStrict(new Set([{a: 1}, {a: 1}, {a: 2}]), new Set([{a: 1}, {a: 2}, {a: 2}]));
notUtilIsDeepStrict(new Map([[{x: 1}, 5], [{x: 1}, 5]]), new Map([[{x: 1}, 5], [{x: 2}, 5]]));
notUtilIsDeepStrict(
new Map([
[{x: 1}, 5],
[{x: 1}, 5],
]),
new Map([
[{x: 1}, 5],
[{x: 2}, 5],
]),
);

notUtilIsDeepStrict(new Set([3, '3']), new Set([3, 4]));
notUtilIsDeepStrict(new Map([[3, 0], ['3', 0]]), new Map([[3, 0], [4, 0]]));
notUtilIsDeepStrict(
new Map([
[3, 0],
['3', 0],
]),
new Map([
[3, 0],
[4, 0],
]),
);

notUtilIsDeepStrict(new Set([{a: 1}, {a: 1}, {a: 2}]), new Set([{a: 1}, {a: 2}, {a: 2}]));

// Mixed primitive and object keys
utilIsDeepStrict(new Map([[1, 'a'], [{}, 'a']]), new Map([[1, 'a'], [{}, 'a']]));
utilIsDeepStrict(
new Map([
[1, 'a'],
[{}, 'a'],
]),
new Map([
[1, 'a'],
[{}, 'a'],
]),
);
utilIsDeepStrict(new Set([1, 'a', [{}, 'a']]), new Set([1, 'a', [{}, 'a']]));

// This is an awful case, where a map contains multiple equivalent keys:
notUtilIsDeepStrict(new Map([[1, 'a'], ['1', 'b']]), new Map([['1', 'a'], [true, 'b']]));
notUtilIsDeepStrict(
new Map([
[1, 'a'],
['1', 'b'],
]),
new Map([
['1', 'a'],
[true, 'b'],
]),
);
notUtilIsDeepStrict(new Set(['a']), new Set(['b']));
utilIsDeepStrict(new Map([[{}, 'a'], [{}, 'b']]), new Map([[{}, 'b'], [{}, 'a']]));
notUtilIsDeepStrict(new Map([[true, 'a'], ['1', 'b'], [1, 'a']]), new Map([['1', 'a'], [1, 'b'], [true, 'a']]));
notUtilIsDeepStrict(new Map([[true, 'a'], ['1', 'b'], [1, 'c']]), new Map([['1', 'a'], [1, 'b'], [true, 'a']]));
utilIsDeepStrict(
new Map([
[{}, 'a'],
[{}, 'b'],
]),
new Map([
[{}, 'b'],
[{}, 'a'],
]),
);
notUtilIsDeepStrict(
new Map([
[true, 'a'],
['1', 'b'],
[1, 'a'],
]),
new Map([
['1', 'a'],
[1, 'b'],
[true, 'a'],
]),
);
notUtilIsDeepStrict(
new Map([
[true, 'a'],
['1', 'b'],
[1, 'c'],
]),
new Map([
['1', 'a'],
[1, 'b'],
[true, 'a'],
]),
);

// Similar object keys
notUtilIsDeepStrict(new Set([{}, {}]), new Set([{}, 1]));
notUtilIsDeepStrict(new Set([[{}, 1], [{}, 1]]), new Set([[{}, 1], [1, 1]]));
notUtilIsDeepStrict(new Map([[{}, 1], [{}, 1]]), new Map([[{}, 1], [1, 1]]));
notUtilIsDeepStrict(new Map([[{}, 1], [true, 1]]), new Map([[{}, 1], [1, 1]]));
notUtilIsDeepStrict(
new Set([
[{}, 1],
[{}, 1],
]),
new Set([
[{}, 1],
[1, 1],
]),
);
notUtilIsDeepStrict(
new Map([
[{}, 1],
[{}, 1],
]),
new Map([
[{}, 1],
[1, 1],
]),
);
notUtilIsDeepStrict(
new Map([
[{}, 1],
[true, 1],
]),
new Map([
[{}, 1],
[1, 1],
]),
);

// Similar primitive key / values
notUtilIsDeepStrict(new Set([1, true, false]), new Set(['1', 0, '0']));
notUtilIsDeepStrict(new Map([[1, 5], [true, 5], [false, 5]]), new Map([['1', 5], [0, 5], ['0', 5]]));
notUtilIsDeepStrict(
new Map([
[1, 5],
[true, 5],
[false, 5],
]),
new Map([
['1', 5],
[0, 5],
['0', 5],
]),
);

// Undefined value in Map
utilIsDeepStrict(new Map([[1, undefined]]), new Map([[1, undefined]]));
Expand Down
16 changes: 8 additions & 8 deletions dist/is-deep-strict-equal-x.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/is-deep-strict-equal-x.esm.js.map

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions dist/is-deep-strict-equal-x.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/is-deep-strict-equal-x.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/is-deep-strict-equal-x.min.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions dist/is-deep-strict-equal-x.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*!
* is-var-name | ISC (c) Shinnosuke Watanabe
* https://github.com/shinnn/is-var-name
*/

/*!
{
"copywrite": "Copyright (c) 2015-2017",
"date": "2020-01-31T11:35:40.841Z",
"describe": "",
"description": "node's isDeepStrictEqual algorithm.",
"file": "is-deep-strict-equal-x.min.js",
"hash": "636866624259d1fced66",
"license": "MIT",
"version": "1.1.2"
}
*/
2 changes: 1 addition & 1 deletion dist/is-deep-strict-equal-x.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 7b48182

Please sign in to comment.