From 31fa7a491943925b5e0304d96e122d3d96af75b2 Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 31 Mar 2023 20:27:45 -0300 Subject: [PATCH] usar map en vez de objeto crudo --- src/index.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index ae4908b..79a4b20 100644 --- a/src/index.ts +++ b/src/index.ts @@ -123,10 +123,8 @@ function processFile(content: string): Promise { }); } -interface Reports { - [key: string]: Report; -} -let reports: Reports = {}; +type Reports = Map; +let reports: Reports = new Map(); async function recurseDirectory(reports: Reports, path: string) { const dir = await readdir(path, { withFileTypes: true }); return await Promise.all( @@ -136,7 +134,7 @@ async function recurseDirectory(reports: Reports, path: string) { else { if (!file.name.endsWith(".html")) return; const content = await readFile(filePath, "utf-8"); - reports[filePath] = await processFile(content); + reports.set(filePath, await processFile(content)); } }) );