-
Couldn't load subscription status.
- Fork 123
Open
Description
The documentation says to set numbers: true to parse option-array values as numbers. However, this value can be anything other than true and yargs will still use number parsing. This is particularly confusing when trying to set numbers: false or numbers: undefined.
> const parser = require('yargs-parser')
undefined
> parser('--foo dog cat', {array: {key: 'foo'}})
{ _: [], foo: [ 'dog', 'cat' ] }
> parser('--foo dog cat', {array: {key: 'foo', number: false}})
{ _: [], foo: [ NaN, NaN ] }
> parser('--foo dog cat', {array: {key: 'foo', number: undefined}})
{ _: [], foo: [ NaN, NaN ] }
This applies to boolean as well.