Skip to content

Commit

Permalink
tools: replace for loop with map()
Browse files Browse the repository at this point in the history
Refs: nodejs#41406 (comment)
Co-authored-by: Tobias Nießen <tniessen@tnie.de>

PR-URL: nodejs#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>
  • Loading branch information
Trott authored and thedull committed Jan 18, 2022
1 parent 7a828ff commit c579369
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions tools/doc/allhtml.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c579369

Please sign in to comment.