Skip to content

Commit 12fd0e6

Browse files
fix: Improve robustness of the short option error message
1 parent a4fc92a commit 12fd0e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function storeOption({
9393
throw new ERR_UNKNOWN_OPTION(shortOption == null ? `--${longOption}` : `-${shortOption}`);
9494
}
9595

96-
const shortOptionErr = optionConfig.short ? `-${optionConfig.short}, ` : '';
96+
const shortOptionErr = ObjectHasOwn(optionConfig, 'short') ? `-${optionConfig.short}, ` : '';
9797

9898
if (options[longOption].type === 'string' && optionValue == null) {
9999
throw new ERR_INVALID_OPTION_VALUE(`Option '${shortOptionErr}--${longOption} <${longOption}>' argument missing`);

0 commit comments

Comments
 (0)