Skip to content

Commit ff1d2ce

Browse files
authored
Improve negative test (#2428)
1 parent 1a6dba5 commit ff1d2ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/command.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
17561756

17571757
const negativeNumberArg = (arg) => {
17581758
// return false if not a negative number
1759-
if (!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(arg)) return false;
1759+
if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
17601760
// negative number is ok unless digit used as an option in command hierarchy
17611761
return !this._getCommandAndAncestors().some((cmd) =>
17621762
cmd.options

0 commit comments

Comments
 (0)