mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
tools: use Set instead of { [key]: true } object
PR-URL: https://github.com/nodejs/node/pull/41675 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
1 parent
12c1ac4d3b
commit
5fe7cfabaa
1 file changed
+3
-6
@@ -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.
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user