🎨 Be explicit in parsing regexp match result
This commit is contained in:
parent
cdf4fbe117
commit
384fee4112
1 changed files with 1 additions and 1 deletions
|
@ -5,7 +5,7 @@ export default function parseSpecEntry({ outputArgs, requiredOptions, shortToLon
|
||||||
if (longOption === '') {
|
if (longOption === '') {
|
||||||
throw new Error(`The long option may not be an empty string. This is a bug in the source code of the script that you tried to call.`);
|
throw new Error(`The long option may not be an empty string. This is a bug in the source code of the script that you tried to call.`);
|
||||||
}
|
}
|
||||||
if (!longOption.match(/^[a-z0-9]+(-[a-z0-9]+)*$/)) {
|
if (longOption.match(/^[a-z0-9]+(?:-[a-z0-9]+)*$/) === null) {
|
||||||
throw new Error(`The long option "${longOption}" must only contain alpha-numeric characters, optionally separated by hyphens. This is a bug in the source code of the script that you tried to call.`);
|
throw new Error(`The long option "${longOption}" must only contain alpha-numeric characters, optionally separated by hyphens. This is a bug in the source code of the script that you tried to call.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue