Skip to content

Commit 5fe7cfa

Browse files
tniessenBethGriggs
authored andcommitted
tools: use Set instead of { [key]: true } object
PR-URL: #41675 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 12c1ac4 commit 5fe7cfa

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

tools/doc/allhtml.mjs

+3-6
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@ let apicontent = '';
1818

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

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

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

7067
// Mark source as seen.
71-
seen[href] = true;
68+
seen.add(href);
7269
}
7370

7471
// Replace various mentions of index with all.

0 commit comments

Comments
 (0)