We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 22df50c commit e3f239dCopy full SHA for e3f239d
2 files changed
lib/index.js
@@ -21,7 +21,8 @@ function toBool(any) {
21
}
22
23
function toNum(any) {
24
- return (!isBool(any) && Number(any)) || any;
+ let x = Number(any);
25
+ return !isBool(any) && (x * 0 === 0) ? x : any;
26
27
28
function getAlibi(names, arr) {
test/index.js
@@ -25,6 +25,8 @@ test('comprehensive', t => {
'--bool',
'--no-meep',
'--multi=baz',
+ '--number=-123',
29
+ '--zeronum=0',
30
'--',
31
'--not-a-flag',
32
'eek'
@@ -41,6 +43,8 @@ test('comprehensive', t => {
41
43
multi: ['quux', 'baz'],
42
44
meep: false,
45
name: 'meowmers',
46
+ number: -123,
47
+ zeronum: 0,
48
_: ['bare', '--not-a-flag', 'eek']
49
50
);
0 commit comments