From aa1c6654211669ac20db6460d1cad6c00b4dd429 Mon Sep 17 00:00:00 2001 From: "Jill \"oatmealine\" Monoids" Date: Thu, 4 Nov 2021 09:19:28 +0300 Subject: [PATCH] oops i accidentally parsed 3x the files i needed --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 898ef09..c709843 100644 --- a/index.js +++ b/index.js @@ -180,14 +180,14 @@ function parse(code) { return elements; } -async function recursiveReaddir(rpath, p, fileNames) { +async function recursiveReaddir(rpath, p) { p = p || ''; - fileNames = (fileNames || []).slice(); + let fileNames = []; const files = await fs.readdir(rpath); for (const f of files) { const stat = await fs.lstat(path.join(rpath, f)); if (stat.isDirectory() || stat.isSymbolicLink()) { - fileNames.push(...await recursiveReaddir(path.join(rpath, f), p + f + '/', fileNames)); + fileNames.push(...await recursiveReaddir(path.join(rpath, f), p + f + '/')); } else { fileNames.push(p + f); }