From 442217ed0353973ca6114d0e7780da4d4d48d5ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Tue, 25 Jan 2022 20:39:40 +0100 Subject: [PATCH] tools: use Set instead of { [key]: true } object Refs: https://github.com/nodejs/node/pull/41675 --- tools/doc/alljson.mjs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/doc/alljson.mjs b/tools/doc/alljson.mjs index 88f25bba40a149..47b0d6a14dab33 100644 --- a/tools/doc/alljson.mjs +++ b/tools/doc/alljson.mjs @@ -23,17 +23,14 @@ const results = { // Identify files that should be skipped. As files are processed, they // are added to this list to prevent dupes. -const seen = { - 'all.json': true, - 'index.json': true -}; +const seen = new Set(['all.json', 'index.json']); // Extract (and concatenate) the selected data from each document. // Expand hrefs found in json to include source HTML file. for (const link of toc.match(//g)) { const href = /href="(.*?)"/.exec(link)[1]; const json = href.replace('.html', '.json'); - if (!jsonFiles.includes(json) || seen[json]) continue; + if (!jsonFiles.includes(json) || seen.has(json)) continue; const data = JSON.parse( fs.readFileSync(new URL(`./${json}`, source), 'utf8') .replace(//g)) { } // Mark source as seen. - seen[json] = true; + seen.add(json); } // Write results.