Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
tools: use Set instead of { [key]: true } object
  • Loading branch information
tniessen committed Jan 24, 2022
commit 07b9526014b494a573f59bdaf1a20c8cfcf51227
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("https://github.com/nodejs/node/pull/41675/commits/%60./$%7Bhref%7D%60,%20source"), '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