summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2022-01-08 19:46:56 -0800
committerGitHub <noreply@github.com>2022-01-09 03:46:56 +0000
commite2470890574d3d4ccafb8250a1de887351b4e9a6 (patch)
tree5bae1753a1fd9fd282498945bd17a70385e0150d /tools
parent154857893149e0a8b9beffce5d96e92b143b6ef3 (diff)
downloadnode-new-e2470890574d3d4ccafb8250a1de887351b4e9a6.tar.gz
tools: replace while+exec() with matchAll()
PR-URL: https://github.com/nodejs/node/pull/41406 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/doc/allhtml.mjs7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/doc/allhtml.mjs b/tools/doc/allhtml.mjs
index 13fda2c573..c597bebdbc 100644
--- a/tools/doc/allhtml.mjs
+++ b/tools/doc/allhtml.mjs
@@ -103,12 +103,13 @@ fs.writeFileSync(new URL('./all.html', source), all, 'utf8');
// Validate all hrefs have a target.
const ids = new Set();
const idRe = / id="([^"]+)"/g;
-let match;
-while (match = idRe.exec(all)) {
+const idMatches = all.matchAll(idRe);
+for (const match of idMatches) {
ids.add(match[1]);
}
const hrefRe = / href="#([^"]+)"/g;
-while (match = hrefRe.exec(all)) {
+const hrefMatches = all.matchAll(hrefRe);
+for (const match of hrefMatches) {
if (!ids.has(match[1])) throw new Error(`link not found: ${match[1]}`);
}