Skip to content

Commit

Permalink
tools: replace for loop with map()
Browse files Browse the repository at this point in the history
Refs: #41406 (comment)
Co-authored-by: Tobias Nießen <[email protected]>
  • Loading branch information
Trott and tniessen committed Jan 9, 2022
1 parent 7edb50d commit 39aaab2
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 39aaab2

Please sign in to comment.