1
- var assign = require ( 'lodash.assign' )
2
1
var camelCase = require ( 'camelcase' )
3
2
var path = require ( 'path' )
4
3
var tokenizeArgString = require ( './lib/tokenize-arg-string' )
@@ -11,7 +10,7 @@ function parse (args, opts) {
11
10
args = tokenizeArgString ( args )
12
11
// aliases might have transitive relationships, normalize this.
13
12
var aliases = combineAliases ( opts . alias || { } )
14
- var configuration = assign ( { } , {
13
+ var configuration = assign ( {
15
14
'short-option-groups' : true ,
16
15
'camel-case-expansion' : true ,
17
16
'dot-notation' : true ,
@@ -692,6 +691,20 @@ function combineAliases (aliases) {
692
691
return combined
693
692
}
694
693
694
+ function assign ( defaults , configuration ) {
695
+ var o = { }
696
+ configuration = configuration || { }
697
+
698
+ Object . keys ( configuration ) . forEach ( function ( k ) {
699
+ o [ k ] = configuration [ k ]
700
+ } )
701
+ Object . keys ( defaults ) . forEach ( function ( k ) {
702
+ if ( o [ k ] === undefined ) o [ k ] = defaults [ k ]
703
+ } )
704
+
705
+ return o
706
+ }
707
+
695
708
// this function should only be called when a count is given as an arg
696
709
// it is NOT called to set a default value
697
710
// thus we can start the count at 1 instead of 0
0 commit comments