-
Notifications
You must be signed in to change notification settings - Fork 123
Closed
Description
array
of type number
is not affected by duplicate-arguments-array
and doesn't reduce duplicated arguments:
var args = parse(
['--file', '2', '--file', '6', '--timeout', '2s', '--timeout', '800'], {
array: [{key: 'file', number: true}],
string: ['timeout'],
configuration: {
'duplicate-arguments-array': false
}
});
console.log(args); // { _: [], file: [ 2, 6 ], timeout: '800' }
array
of type string
does reduce duplicated arguments with duplicate-arguments-array
:
var args = parse(
['--file', '2', '--file', '6', '--timeout', '2s', '--timeout', '800'], {
array: [{key: 'file', string: true}],
string: ['timeout'],
configuration: {
'duplicate-arguments-array': false
}
});
console.log(args); // { _: [], file: [ '6' ], timeout: '800' }
An array
of type boolean
is always reduced, indepently of duplicate-arguments-array
. So it doesn't seem possible to build an array
of boolean
with more than one element.
It is not clear:
- wether
duplicate-arguments-array
should reducearray
's at all. Analysing the tests, the answer is yes. Maybe it would be more logical to excludearray
's from this rule? - the behavior of typed
array
's is not consistent (number <=> string).
Metadata
Metadata
Assignees
Labels
No labels