From 7302d3bf3c2747600bf7844f7ac9be53fbcba7e6 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Thu, 25 Jan 2024 09:54:24 -0800 Subject: [PATCH] fix: another edge case for input.args --- src/inputs/run-install.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/inputs/run-install.ts b/src/inputs/run-install.ts index dcd273a..f1dd44a 100644 --- a/src/inputs/run-install.ts +++ b/src/inputs/run-install.ts @@ -52,16 +52,18 @@ function isEntryValid(input: any): boolean { return false; } - if (input.args !== undefined && !Array.isArray(input.args)) { - error(`Invalid input for run_install.args. Expected array, but got ${typeof input.args}`) - return false; - } + if (input.args !== undefined) { + if (!Array.isArray(input.args)) { + error(`Invalid input for run_install.args. Expected array, but got ${typeof input.args}`) + return false; + } - const invalidArgs: any[] = input.args.filter((arg: any) => typeof arg !== 'string'); - if (input.args !== undefined && invalidArgs.length > 0) { - const invalidArgsMessage = invalidArgs.map((arg: any) => typeof arg).join(', '); - error(`Invalid input for run_install.args. Expected array of strings, but got ${invalidArgsMessage}`) - return false; + const invalidArgs: any[] = input.args.filter((arg: any) => typeof arg !== 'string'); + if (invalidArgs.length > 0) { + const invalidArgsMessage = invalidArgs.map((arg: any) => typeof arg).join(', '); + error(`Invalid input for run_install.args. Expected array of strings, but got ${invalidArgsMessage}`) + return false; + } } return true;