From f55279346af83804a0d47e8273eb597cec0b5572 Mon Sep 17 00:00:00 2001 From: SamKirkland Date: Mon, 31 Jan 2022 00:44:08 -0600 Subject: [PATCH] exclude defaults bug fix --- dist/index.js | 3 +++ src/parse.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/dist/index.js b/dist/index.js index ecc6103..67bdd70 100644 --- a/dist/index.js +++ b/dist/index.js @@ -7984,6 +7984,9 @@ function optionalInt(argumentName, rawValue) { } exports.optionalInt = optionalInt; function optionalStringArray(argumentName, rawValue) { + if (rawValue.length === 0) { + return undefined; + } if (typeof rawValue === "string") { throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". This option expects an list in the EXACT format described in the readme`); } diff --git a/src/parse.ts b/src/parse.ts index 98f45a4..3e73658 100644 --- a/src/parse.ts +++ b/src/parse.ts @@ -91,6 +91,10 @@ export function optionalInt(argumentName: string, rawValue: string): number | un } export function optionalStringArray(argumentName: string, rawValue: string[]): string[] | undefined { + if (rawValue.length === 0) { + return undefined; + } + if (typeof rawValue === "string") { throw new Error(`${argumentName}: invalid parameter - you provided "${rawValue}". This option expects an list in the EXACT format described in the readme`); }