@@ -15,28 +15,30 @@ const processFlags = (flags) => {
1515 let value = null ;
1616 const isNoFlag = flags . includes ( "--no-" ) ;
1717
18- lodash
19- . compact ( lodash . split ( flags , " " ) . map ( ( str ) => str . replace ( / , / g, "" ) ) )
20- . forEach ( ( str ) => {
21- if ( str . startsWith ( "-" ) ) {
22- keys . push ( str ) ;
23- } else if ( value === null ) {
24- if ( str . startsWith ( "{" ) || str . startsWith ( "[" ) || str . startsWith ( "<" ) ) {
25- const rawValue = str . replace ( / [ { [ < > } \] . ] / g, "" ) ;
26- const variadic = str . includes ( "..." ) ;
27- value = {
28- raw : str ,
29- variadic,
30- name : rawValue ,
31- formatter : optionFormatters [ rawValue ] || optionFormatters . string ,
32- } ;
33- }
18+ const strArr = lodash . compact (
19+ flags . split ( " " ) . map ( ( str ) => str . replace ( / , / g, "" ) ) ,
20+ ) ;
21+
22+ for ( const str of strArr ) {
23+ if ( str . startsWith ( "-" ) ) {
24+ keys . push ( str ) ;
25+ } else if ( value === null ) {
26+ if ( str . startsWith ( "{" ) || str . startsWith ( "[" ) || str . startsWith ( "<" ) ) {
27+ const rawValue = str . replace ( / [ { [ < > } \] . ] / g, "" ) ;
28+ const variadic = str . includes ( "..." ) ;
29+ value = {
30+ raw : str ,
31+ variadic,
32+ name : rawValue ,
33+ formatter : optionFormatters [ rawValue ] || optionFormatters . string ,
34+ } ;
3435 }
35- } ) ;
36+ }
37+ }
3638
3739 const longestKey = keys . slice ( ) . sort ( ( a , b ) => b . length - a . length ) [ 0 ] ;
3840
39- if ( ! lodash . isEmpty ( longestKey ) ) {
41+ if ( longestKey !== "" ) {
4042 name = lodash . camelCase (
4143 ( isNoFlag ? longestKey . replace ( "--no-" , "" ) : longestKey ) . replace (
4244 / ( - - ? ) / ,
0 commit comments