Skip to content

Commit 1cbdc98

Browse files
tniessendanielleadams
authored andcommitted
tools: use Set instead of { [key]: true } object
PR-URL: #41675 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 55fce66 commit 1cbdc98

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

‎tools/doc/allhtml.mjs‎

Lines changed: 3 additions & 6 deletions
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-
constseen={
22-
'all.html': true,
23-
'index.html': true
24-
};
21+
constseen=newSet(['all.html','index.html']);
2522

2623
for(constlinkoftoc.match(/<a.*?>/g)){
2724
consthref=/href="(.*?)"/.exec(link)[1];
28-
if(!htmlFiles.includes(href)||seen[href])continue;
25+
if(!htmlFiles.includes(href)||seen.has(href))continue;
2926
constdata=fs.readFileSync(newURL(`./${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)