|
8 | 8 | ArrayPrototypePush, |
9 | 9 | StringPrototypeCharAt, |
10 | 10 | StringPrototypeIncludes, |
| 11 | + StringPrototypeIndexOf, |
11 | 12 | StringPrototypeSlice, |
12 | | - StringPrototypeSplit, |
13 | 13 | StringPrototypeStartsWith, |
14 | 14 | } = require('./primordials'); |
15 | 15 |
|
@@ -110,15 +110,16 @@ const parseArgs = ( |
110 | 110 | arg = StringPrototypeSlice(arg, 2); // remove leading -- |
111 | 111 |
|
112 | 112 | if (StringPrototypeIncludes(arg, '=')) { |
113 | | - // withValue equals(=) case |
114 | | - const argParts = StringPrototypeSplit(arg, '='); |
115 | | - |
116 | | - // If withValue option is specified, take 2nd part after '=' as value, |
117 | | - // else set value as undefined |
118 | | - const val = options.withValue && |
119 | | - ArrayPrototypeIncludes(options.withValue, argParts[0]) ? |
120 | | - argParts[1] : undefined; |
121 | | - storeOptionValue(options, argParts[0], val, result); |
| 113 | + // Store option=value same way independent of `withValue` as: |
| 114 | + // - looks like a value, store as a value |
| 115 | + // - match the intention of the user |
| 116 | + // - preserve information for author to process further |
| 117 | + const index = StringPrototypeIndexOf(arg, '='); |
| 118 | + storeOptionValue( |
| 119 | + options, |
| 120 | + StringPrototypeSlice(arg, 0, index), |
| 121 | + StringPrototypeSlice(arg, index + 1), |
| 122 | + result); |
122 | 123 | } else if (pos + 1 < argv.length && |
123 | 124 | !StringPrototypeStartsWith(argv[pos + 1], '-') |
124 | 125 | ) { |
|
0 commit comments