Skip to content

Commit 3190e36

Browse files
tniessenruyadorno
authored andcommitted
tools: use Set instead of{[key]: true } object
Refs: #41675 PR-URL: #41695 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 2a18859 commit 3190e36

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

‎tools/doc/alljson.mjs‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,14 @@ const results ={
2323

2424
// Identify files that should be skipped. As files are processed, they
2525
// are added to this list to prevent dupes.
26-
constseen={
27-
'all.json': true,
28-
'index.json': true
29-
};
26+
constseen=newSet(['all.json','index.json']);
3027

3128
// Extract (and concatenate) the selected data from each document.
3229
// Expand hrefs found in json to include source HTML file.
3330
for(constlinkoftoc.match(/<a.*?>/g)){
3431
consthref=/href="(.*?)"/.exec(link)[1];
3532
constjson=href.replace('.html','.json');
36-
if(!jsonFiles.includes(json)||seen[json])continue;
33+
if(!jsonFiles.includes(json)||seen.has(json))continue;
3734
constdata=JSON.parse(
3835
fs.readFileSync(newURL(`./${json}`,source),'utf8')
3936
.replace(/<ahref=\\"#/g,`<a href=\\"${href}#`)
@@ -49,7 +46,7 @@ for (const link of toc.match(/<a.*?>/g)){
4946
}
5047

5148
// Mark source as seen.
52-
seen[json]=true;
49+
seen.add(json);
5350
}
5451

5552
// Write results.

0 commit comments

Comments
(0)