From 5fe7cfabaaf919fa8d5c33145d4cb17c8e8d6cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Mon, 24 Jan 2022 12:46:47 +0100 Subject: [PATCH] tools: use Set instead of { [key]: true } object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/41675 Reviewed-By: Michaƫl Zasso Reviewed-By: Benjamin Gruenbaum Reviewed-By: Antoine du Hamel --- tools/doc/allhtml.mjs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/doc/allhtml.mjs b/tools/doc/allhtml.mjs index 3c45b149861a5c..50f145034ccb7a 100644 --- a/tools/doc/allhtml.mjs +++ b/tools/doc/allhtml.mjs @@ -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(//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(//g)) { .trim() + '\n'; // Mark source as seen. - seen[href] = true; + seen.add(href); } // Replace various mentions of index with all.