@@ -2160,6 +2160,19 @@ describe('yargs-parser', function () {
2160
2160
expect ( parsed [ 'bar' ] ) . to . equal ( 6 )
2161
2161
expect ( parsed [ 'baz' ] ) . to . equal ( 7 )
2162
2162
} )
2163
+
2164
+ it ( 'should coerce elements of number typed arrays to numbers' , function ( ) {
2165
+ var parsed = parser ( [ '--foo' , '4' , '--foo' , '5' , '2' ] , {
2166
+ array : [ 'foo' ] ,
2167
+ configObjects : [ { foo : [ '1' , '2' , '3' ] } ] ,
2168
+ configuration : {
2169
+ 'combine-arrays' : true ,
2170
+ 'flatten-duplicate-arrays' : false
2171
+ }
2172
+ } )
2173
+
2174
+ expect ( parsed [ 'foo' ] ) . to . deep . equal ( [ [ 4 ] , [ 5 , 2 ] , [ 1 , 2 , 3 ] ] )
2175
+ } )
2163
2176
} )
2164
2177
2165
2178
describe ( 'boolean negation' , function ( ) {
@@ -2445,15 +2458,15 @@ describe('yargs-parser', function () {
2445
2458
} )
2446
2459
describe ( 'duplicate=true, flatten=false,' , function ( ) {
2447
2460
describe ( 'type=array' , function ( ) {
2448
- it ( '[-x 1 -x 2 -x 3] => [1, 2, 3 ]' , function ( ) {
2461
+ it ( '[-x 1 -x 2 -x 3] => [[1], [2], [3] ]' , function ( ) {
2449
2462
var parsed = parser ( '-x 1 -x 2 -x 3' , {
2450
2463
array : [ 'x' ] ,
2451
2464
configuration : {
2452
2465
'duplicate-arguments-array' : true ,
2453
2466
'flatten-duplicate-arrays' : false
2454
2467
}
2455
2468
} )
2456
- parsed [ 'x' ] . should . deep . equal ( [ 1 , 2 , 3 ] )
2469
+ parsed [ 'x' ] . should . deep . equal ( [ [ 1 ] , [ 2 ] , [ 3 ] ] )
2457
2470
} )
2458
2471
it ( '[-x 1 2 3 -x 2 3 4] => [[1, 2, 3], [ 2, 3, 4]]' , function ( ) {
2459
2472
var parsed = parser ( '-x 1 2 3 -x 2 3 4' , {
0 commit comments