From b50c6d07d4c63c5c78b2eac83eba07a5da1619ac Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 17 Jun 2021 17:13:17 -0400 Subject: [PATCH] checkPlugin: Improve readability of `files` assignment --- src/bin/plugins/checkPlugin.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/bin/plugins/checkPlugin.js b/src/bin/plugins/checkPlugin.js index 8d983c62f..57116737b 100755 --- a/src/bin/plugins/checkPlugin.js +++ b/src/bin/plugins/checkPlugin.js @@ -136,17 +136,14 @@ fs.readdir(pluginPath, (err, rootFiles) => { return console.log(`Unable to scan directory: ${err}`); } - // rewriting files to lower case - const files = []; - // some files we need to know the actual file name. Not compulsory but might help in the future. let readMeFileName; let repository; - - for (let i = 0; i < rootFiles.length; i++) { - if (rootFiles[i].toLowerCase().includes('readme')) readMeFileName = rootFiles[i]; - files.push(rootFiles[i].toLowerCase()); - } + const files = rootFiles.map((f) => { + const fl = f.toLowerCase(); + if (fl.includes('readme')) readMeFileName = f; + return fl; + }); if (!files.includes('.git')) throw new Error('No .git folder, aborting'); prepareRepo();