browser-ava 2.3.35 → 2.3.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-ava",
3
- "version": "2.3.35",
3
+ "version": "2.3.36",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -47,7 +47,7 @@
47
47
  "ws": "^8.18.3"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/node": "^24.5.2",
50
+ "@types/node": "^24.6.2",
51
51
  "ava": "^6.4.1",
52
52
  "c8": "^10.1.3",
53
53
  "documentation": "^14.0.3",
@@ -1,16 +1,29 @@
1
1
  export function isEqual(a, b) {
2
+ return _isEqual(a, b, new Set());
3
+ }
4
+
5
+ function _isEqual(a, b, seen) {
2
6
  if (a !== undefined && b === undefined) {
3
7
  return false;
4
8
  }
9
+ if (a === undefined && b !== undefined) {
10
+ return false;
11
+ }
5
12
 
6
13
  if (isScalar(a)) {
7
14
  return Object.is(a, b);
8
15
  }
9
16
 
17
+ if(seen.has(a)) {
18
+ return false;
19
+ }
20
+
21
+ seen.add(a);
22
+
10
23
  if (Array.isArray(a)) {
11
24
  if (a.length === b.length) {
12
25
  for (let i = 0; i < a.length; i++) {
13
- if (!isEqual(a[i], b[i])) {
26
+ if (!_isEqual(a[i], b[i], seen)) {
14
27
  return false;
15
28
  }
16
29
  }
@@ -21,10 +34,9 @@ export function isEqual(a, b) {
21
34
  }
22
35
 
23
36
  if (typeof a === "object") {
24
-
25
- if(a instanceof ArrayBuffer) {
26
- if(b instanceof ArrayBuffer) {
27
- return a.byteLength === b.byteLength;
37
+ if (a instanceof ArrayBuffer) {
38
+ if (b instanceof ArrayBuffer) {
39
+ return a.byteLength === b.byteLength;
28
40
  }
29
41
  }
30
42
 
@@ -32,7 +44,7 @@ export function isEqual(a, b) {
32
44
  return (
33
45
  b instanceof Set &&
34
46
  a.size === b.size &&
35
- [...a].every((value) => b.has(value))
47
+ [...a].every(value => b.has(value))
36
48
  );
37
49
  }
38
50
  if (a instanceof Map) {
@@ -40,7 +52,7 @@ export function isEqual(a, b) {
40
52
  return false;
41
53
  }
42
54
  for (const [k, v] of a.entries()) {
43
- if (!isEqual(v, b.get(k))) {
55
+ if (!_isEqual(v, b.get(k), seen)) {
44
56
  return false;
45
57
  }
46
58
  }
@@ -49,7 +61,7 @@ export function isEqual(a, b) {
49
61
  }
50
62
 
51
63
  for (const key of new Set(Object.keys(a).concat(Object.keys(b)))) {
52
- if (!isEqual(a[key], b[key])) {
64
+ if (!_isEqual(a[key], b[key], seen)) {
53
65
  return false;
54
66
  }
55
67
  }
@@ -66,7 +78,7 @@ const scalarTypes = new Set([
66
78
  "string",
67
79
  "number",
68
80
  "bigint",
69
- "boolean",
81
+ "boolean"
70
82
  ]);
71
83
 
72
84
  export function isScalar(a) {
@@ -75,6 +87,7 @@ export function isScalar(a) {
75
87
  a instanceof String ||
76
88
  a instanceof Number ||
77
89
  a instanceof Function ||
90
+ a instanceof BigInt ||
78
91
  a === null
79
92
  );
80
93
  }