From 12fd0e6d58fda45d49f2d310cf4ec0090e03fcbe Mon Sep 17 00:00:00 2001 From: Aaron Casanova <32409546+aaronccasanova@users.noreply.github.com> Date: Tue, 12 Apr 2022 11:52:01 -0700 Subject: [PATCH] fix: Improve robustness of the short option error message --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 25f9312..7d1ce05 100644 --- a/index.js +++ b/index.js @@ -93,7 +93,7 @@ function storeOption({ throw new ERR_UNKNOWN_OPTION(shortOption == null ? `--${longOption}` : `-${shortOption}`); } - const shortOptionErr = optionConfig.short ? `-${optionConfig.short}, ` : ''; + const shortOptionErr = ObjectHasOwn(optionConfig, 'short') ? `-${optionConfig.short}, ` : ''; if (options[longOption].type === 'string' && optionValue == null) { throw new ERR_INVALID_OPTION_VALUE(`Option '${shortOptionErr}--${longOption} <${longOption}>' argument missing`);