assert,util: revert recursive breaking change

This commit is there to be reverted after merging. It makes it easy
to backport the overall PR and allows easy forward fixing.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: https://github.com/nodejs/node/pull/46593
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Ruben Bridgewater authored and Michaël Zasso committed 2023-03-13 11:27:42 +01:00
1 parent 7f85a2cb6f
commit e07c9b82b7
3 files changed
+8 -22

No files matched your search

+2 -10
View File
@@ -546,10 +546,6 @@ An alias of [`assert.ok()`][].
<!-- YAML
added: v0.1.21
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/46593
description: Recursion now stops when either side encounters a circular
reference.
- version: v18.0.0
pr-url: https://github.com/nodejs/node/pull/41020
description: Regular expressions lastIndex property is now compared as well.
@@ -621,7 +617,7 @@ are also recursively evaluated by the following rules.
* [Object wrappers][] are compared both as objects and unwrapped values.
* `Object` properties are compared unordered.
* [`Map`][] keys and [`Set`][] items are compared unordered.
* Recursion stops when both sides differ or either side encounters a circular
* Recursion stops when both sides differ or both sides encounter a circular
reference.
* Implementation does not test the [`[[Prototype]]`][prototype-spec] of
objects.
@@ -731,10 +727,6 @@ parameter is an instance of an [`Error`][] then it will be thrown instead of the
<!-- YAML
added: v1.2.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/46593
description: Recursion now stops when either side encounters a circular
reference.
- version: v18.0.0
pr-url: https://github.com/nodejs/node/pull/41020
description: Regular expressions lastIndex property is now compared as well.
@@ -788,7 +780,7 @@ are recursively evaluated also by the following rules.
* [Object wrappers][] are compared both as objects and unwrapped values.
* `Object` properties are compared unordered.
* [`Map`][] keys and [`Set`][] items are compared unordered.
* Recursion stops when both sides differ or either side encounters a circular
* Recursion stops when both sides differ or both sides encounter a circular
reference.
* [`WeakMap`][] and [`WeakSet`][] comparison does not rely on their values. See
below for further details.
+3 -9
View File
@@ -343,10 +343,7 @@ function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {
if (memos.set === undefined) {
if (memos.deep === false) {
if (memos.a === val1) {
return memos.b === val2;
}
if (memos.b === val2) {
return false;
if (memos.b === val2) return true;
}
memos.c = val1;
memos.d = val2;
@@ -366,12 +363,9 @@ function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {
const originalSize = set.size;
set.add(val1);
if (originalSize === set.size) {
return set.has(val2);
}
set.add(val2);
if (originalSize === set.size - 1) {
return false;
if (originalSize === set.size) {
return true;
}
const areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType);
+3 -3
View File
@@ -425,7 +425,7 @@ assertNotDeepOrStrict(
b.a = {};
b.a.a = a;
assertNotDeepOrStrict(a, b);
assertDeepAndStrictEqual(a, b);
}
{
@@ -435,7 +435,7 @@ assertNotDeepOrStrict(
b.a = b;
const c = {};
c.a = a;
assertNotDeepOrStrict(b, c);
assertDeepAndStrictEqual(b, c);
}
{
@@ -445,7 +445,7 @@ assertNotDeepOrStrict(
b.add(b);
const c = new Set();
c.add(a);
assertNotDeepOrStrict(b, c);
assertDeepAndStrictEqual(b, c);
}
// https://github.com/nodejs/node-v0.x-archive/pull/7178