Skip to content

Commit

Permalink
tools: use Set instead of { [key]: true } object
Browse files Browse the repository at this point in the history
PR-URL: #41675
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
tniessen authored and BethGriggs committed Jan 24, 2022
1 parent 12c1ac4 commit 5fe7cfa
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tools/doc/allhtml.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ let apicontent = '';

// Identify files that should be skipped. As files are processed, they
// are added to this list to prevent dupes.
const seen = {
'all.html': true,
'index.html': true
};
const seen = new Set(['all.html', 'index.html']);

for (const link of toc.match(/<a.*?>/g)) {
const href = /href="(.*?)"/.exec(link)[1];
if (!htmlFiles.includes(href) || seen[href]) continue;
if (!htmlFiles.includes(href) || seen.has(href)) continue;
const data = fs.readFileSync(new URL(`./${href}`, source), 'utf8');

// Split the doc.
Expand Down Expand Up @@ -68,7 +65,7 @@ for (const link of toc.match(/<a.*?>/g)) {
.trim() + '\n';

// Mark source as seen.
seen[href] = true;
seen.add(href);
}

// Replace various mentions of index with all.
Expand Down

0 comments on commit 5fe7cfa

Please sign in to comment.