diff options
author | Rich Trott <rtrott@gmail.com> | 2022-01-09 16:32:56 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2022-01-13 09:10:39 +0300 |
commit | 500241d50df3049603b342afdc0270ecb1faccff (patch) | |
tree | bd93cfc1660829b0a39ac298184e47aee5e5b759 /tools | |
parent | 74b9baa4265a8f0d112dabc3efc63c2e13276488 (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.mjs | 6 |
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); |