diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2021-12-02 11:01:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-02 11:01:40 +0300 |
commit | dab8ab2837ae80b29678d882f2514b987e6764a0 (patch) | |
tree | 3d9dbcfd446c19094ecd9ead00256661fa9b8048 /doc/api/assert.md | |
parent | 34fdea1c57869f097b1fc071da959280dbe44e86 (diff) |
assert,util: compare RegExp.lastIndex while using deep equal checks
Compare the `lastIndex` property of regular expressions next to the
flags and source property.
Fixes: https://github.com/nodejs/node/issues/28766
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: https://github.com/nodejs/node/pull/41020
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Diffstat (limited to 'doc/api/assert.md')
-rw-r--r-- | doc/api/assert.md | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/api/assert.md b/doc/api/assert.md index a22a6082c3a..c7e679ef814 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -465,6 +465,9 @@ An alias of [`assert.ok()`][]. <!-- YAML added: v0.1.21 changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/41020 + description: Regular expressions lastIndex property is now compared as well. - version: - v16.0.0 - v14.18.0 @@ -539,6 +542,8 @@ are also recursively evaluated by the following rules. objects. * [`Symbol`][] properties are not compared. * [`WeakMap`][] and [`WeakSet`][] comparison does not rely on their values. +* [`RegExp`][] lastIndex, flags and source are always compared, even if these + are not enumerable properties. The following example does not throw an [`AssertionError`][] because the primitives are considered equal by the [Abstract Equality Comparison][] @@ -642,6 +647,9 @@ 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/41020 + description: Regular expressions lastIndex property is now compared as well. - version: v9.0.0 pr-url: https://github.com/nodejs/node/pull/15169 description: Enumerable symbol properties are now compared. @@ -697,6 +705,8 @@ are recursively evaluated also by the following rules. reference. * [`WeakMap`][] and [`WeakSet`][] comparison does not rely on their values. See below for further details. +* [`RegExp`][] lastIndex, flags and source are always compared, even if these + are not enumerable properties. ```mjs import assert from 'assert/strict'; |