Comparing version 0.1.4 to 1.0.0
@@ -0,1 +1,6 @@ | ||
# CHANGELOG | ||
### 1.0.0 | ||
- [breaking] Duplicate flags are now consolidated into an array of values. | ||
### 0.1.3 | ||
@@ -2,0 +7,0 @@ - Allow every printable ASCII char to be used within arguments. #9 |
10
index.js
@@ -112,9 +112,15 @@ 'use strict'; | ||
var property = properties.shift(); | ||
var current = position[property]; | ||
if (properties.length) { | ||
if ('object' !== typeof position[property] && !Array.isArray(position[property])) { | ||
if ('object' !== typeof current && !Array.isArray(current)) { | ||
position[property] = Object.create(null); | ||
} | ||
} else { | ||
position[property] = value; | ||
if (property in position) { | ||
if (Array.isArray(current)) current.push(value); | ||
else position[property] = [current, value]; | ||
} else { | ||
position[property] = value; | ||
} | ||
} | ||
@@ -121,0 +127,0 @@ |
{ | ||
"name": "argh", | ||
"version": "0.1.4", | ||
"version": "1.0.0", | ||
"description": "light weight option/argv parser for node, it only parses options, nothing more then that.", | ||
@@ -17,3 +17,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git@github.com:observing/argh.git" | ||
"url": "git@github.com:3rd-Eden/argh.git" | ||
}, | ||
@@ -31,10 +31,10 @@ "keywords": [ | ||
], | ||
"author": "Arnout Kazemier <opensource@observe.it>", | ||
"author": "Arnout Kazemier", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"assume": "1.2.x", | ||
"istanbul": "0.3.x", | ||
"mocha": "2.2.x", | ||
"pre-commit": "1.0.x" | ||
"assume": "~2.2.0", | ||
"istanbul": "~0.4.5", | ||
"mocha": "~6.1.4", | ||
"pre-commit": "~1.2.0" | ||
} | ||
} |
# argh! | ||
[![Build Status](https://travis-ci.org/observing/argh.png?branch=master)](https://travis-ci.org/observing/argh) | ||
`argh` is an extremely light weight options or `process.argv` parser for node.js. | ||
@@ -132,2 +130,12 @@ It only includes the bare minimal to parse options. It's not a full blown cli | ||
## License MIT | ||
Parsing duplicate flags: | ||
``` | ||
$ node parse.js --item foo --item bar --item baz | ||
{ item: [ 'foo', 'bar', 'baz' ] } | ||
``` | ||
## License | ||
[MIT](LICENSE) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
141
0
10082
5
129