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 reduce array's at all. Analysing the tests, the answer is yes. Maybe it would be more logical to exclude array's from this rule?
- the behavior of typed
array's is not consistent (number <=> string).
arrayof typenumberis not affected byduplicate-arguments-arrayand doesn't reduce duplicated arguments:arrayof typestringdoes reduce duplicated arguments withduplicate-arguments-array:An
arrayof typebooleanis always reduced, indepently ofduplicate-arguments-array. So it doesn't seem possible to build anarrayofbooleanwith more than one element.It is not clear:
duplicate-arguments-arrayshould reducearray's at all. Analysing the tests, the answer is yes. Maybe it would be more logical to excludearray's from this rule?array's is not consistent (number <=> string).