usar map en vez de objeto crudo
This commit is contained in:
parent
ecebc434f2
commit
31fa7a4919
1 changed files with 3 additions and 5 deletions
|
@ -123,10 +123,8 @@ function processFile(content: string): Promise<Report> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Reports {
|
type Reports = Map<string, Report>;
|
||||||
[key: string]: Report;
|
let reports: Reports = new Map();
|
||||||
}
|
|
||||||
let reports: Reports = {};
|
|
||||||
async function recurseDirectory(reports: Reports, path: string) {
|
async function recurseDirectory(reports: Reports, path: string) {
|
||||||
const dir = await readdir(path, { withFileTypes: true });
|
const dir = await readdir(path, { withFileTypes: true });
|
||||||
return await Promise.all(
|
return await Promise.all(
|
||||||
|
@ -136,7 +134,7 @@ async function recurseDirectory(reports: Reports, path: string) {
|
||||||
else {
|
else {
|
||||||
if (!file.name.endsWith(".html")) return;
|
if (!file.name.endsWith(".html")) return;
|
||||||
const content = await readFile(filePath, "utf-8");
|
const content = await readFile(filePath, "utf-8");
|
||||||
reports[filePath] = await processFile(content);
|
reports.set(filePath, await processFile(content));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue