From bd234fb543b4d564dd730ecd605a1c8702c6568b Mon Sep 17 00:00:00 2001 From: Pranav Yadav Date: Thu, 30 Mar 2023 11:06:50 +0530 Subject: [PATCH] refactor: "for loop" - argv to config - use `const` for the loop variable, as it's *not* modified in the body - use shorthand syntax for: `config[value] = (argv[value] === true ? true : (config[value] ?? false));` as; `config[value] ||= argv[value] === true;` --- src/main_executor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main_executor.js b/src/main_executor.js index fd7b8efe..b7146e26 100644 --- a/src/main_executor.js +++ b/src/main_executor.js @@ -113,8 +113,8 @@ async function run() { config.dbNodesTable = typeof(argv.dbnodestable) === "string" ? argv.dbnodestable.trim() : "state.nodes"; config.dbProgramTable = typeof(argv.dbprogramtable) === "string" ? argv.dbprogramtable.trim() : "state.program"; - for (let value of ['debug', 'unsigned', 'execute', 'tracer', 'counters', 'skip', 'verbose']) { - config[value] = (argv[value] === true ? true : (config[value] ?? false)); + for (const value of ['debug', 'unsigned', 'execute', 'tracer', 'counters', 'skip', 'verbose']) { + config[value] ||= argv[value] === true; } const input = JSON.parse(await fs.promises.readFile(config.inputFile, "utf8"));