Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2022-01-09 16:32:56 +0300
committerRich Trott <rtrott@gmail.com>2022-01-13 09:10:39 +0300
commit500241d50df3049603b342afdc0270ecb1faccff (patch)
treebd93cfc1660829b0a39ac298184e47aee5e5b759 /tools
parent74b9baa4265a8f0d112dabc3efc63c2e13276488 (diff)
tools: replace for loop with map()
Refs: https://github.com/nodejs/node/pull/41406#discussion_r778979676 Co-authored-by: Tobias Nießen <tniessen@tnie.de> PR-URL: https://github.com/nodejs/node/pull/41451 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/doc/allhtml.mjs6
1 files changed, 1 insertions, 5 deletions
diff --git a/tools/doc/allhtml.mjs b/tools/doc/allhtml.mjs
index c597bebdbcf..3c45b149861 100644
--- a/tools/doc/allhtml.mjs
+++ b/tools/doc/allhtml.mjs
@@ -101,12 +101,8 @@ all = all.slice(0, apiStart.index + apiStart[0].length) +
fs.writeFileSync(new URL('./all.html', source), all, 'utf8');
// Validate all hrefs have a target.
-const ids = new Set();
const idRe = / id="([^"]+)"/g;
-const idMatches = all.matchAll(idRe);
-for (const match of idMatches) {
- ids.add(match[1]);
-}
+const ids = new Set([...all.matchAll(idRe)].map((match) => match[1]));
const hrefRe = / href="#([^"]+)"/g;
const hrefMatches = all.matchAll(hrefRe);