Skip to content

Commit

Permalink
fix: Improve robustness of the short option error message
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronccasanova committed Apr 12, 2022
1 parent a4fc92a commit 12fd0e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down

0 comments on commit 12fd0e6

Please sign in to comment.