dashdash
Advanced tools
Comparing version 1.10.1 to 1.11.0
@@ -375,3 +375,9 @@ /** | ||
} | ||
opts[key].push(parsedVal); | ||
if (type.arrayFlatten && Array.isArray(parsedVal)) { | ||
for (var i = 0; i < parsedVal.length; i++) { | ||
opts[key].push(parsedVal[i]); | ||
} | ||
} else { | ||
opts[key].push(parsedVal); | ||
} | ||
} else { | ||
@@ -777,2 +783,3 @@ opts[key] = parsedVal; | ||
* puts results in an array. | ||
* - arrayFlatten {Boolean} Optional. XXX | ||
* - default Optional. Default value for options of this type, if no | ||
@@ -790,2 +797,3 @@ * default is specified in the option type usage. | ||
assert.optionalBool(optionType.array, 'optionType.array'); | ||
assert.optionalBool(optionType.arrayFlatten, 'optionType.arrayFlatten'); | ||
@@ -797,2 +805,3 @@ optionTypes[optionType.name] = { | ||
array: optionType.array, | ||
arrayFlatten: optionType.arrayFlatten, | ||
default: optionType.default | ||
@@ -799,0 +808,0 @@ } |
{ | ||
"name": "dashdash", | ||
"description": "A light, featureful and explicit option parsing library.", | ||
"version": "1.10.1", | ||
"version": "1.11.0", | ||
"author": "Trent Mick <trentm@gmail.com> (http://trentm.com)", | ||
@@ -6,0 +6,0 @@ "keywords": ["option", "parser", "parsing", "cli", "command", "args"], |
@@ -426,3 +426,3 @@ A light, featureful and explicit option parsing library for node.js. | ||
Dashdash includes a good starter set of option types that it will parse for | ||
you. However you can add your own via: | ||
you. However, you can add your own via: | ||
@@ -437,2 +437,4 @@ var dashdash = require('dashdash'); | ||
}, | ||
array: false, // optional | ||
arrayFlatten: false, // optional | ||
default: ... // optional | ||
@@ -471,4 +473,5 @@ }); | ||
See "examples/custom-option-duration.js" for another example adding a "duration" | ||
option type. Please let me know [on twitter](https://twitter.com/trentmick) | ||
See "examples/custom-option-\*.js" for other examples. | ||
See the `addOptionType` block comment in "lib/dashdash.js" for more details. | ||
Please let me know [on twitter](https://twitter.com/trentmick) | ||
or [with an issue](https://github.com/trentm/node-dashdash/issues/new) if you | ||
@@ -475,0 +478,0 @@ write a generally useful one. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
42300
750
512
0