args-parser
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -6,2 +6,2 @@ /* | ||
*/ | ||
"use strict";function Parse(a){a=a.slice(2);var b={};return a.forEach(function(a,c){a=a.split("=");var d=a[0];"--"==d.slice(0,2)&&(d=d.slice(2)),"-"==d.slice(0,1)&&(d=d.slice(1));var e=2===a.length?a[1]:void 0;b[d]=e}),b}module.exports=Parse; | ||
"use strict";function Parse(a){a=a.slice(2);var b={};return a.forEach(function(a,c){a=a.split("=");var d=a[0];"--"==d.slice(0,2)&&(d=d.slice(2)),"-"==d.slice(0,1)&&(d=d.slice(1));var e=2===a.length?a[1]:true;b[d]=e}),b}module.exports=Parse; |
{ | ||
"name": "args-parser", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Straight-forward node.js arguments parser", | ||
@@ -5,0 +5,0 @@ "main": "parse.js", |
@@ -34,4 +34,4 @@ "use strict"; | ||
// Associate defined value or initialize it to "undefined" state | ||
var argValue = (arg.length === 2) ? arg[1] : undefined; | ||
// Associate defined value or initialize it to "true" state | ||
var argValue = (arg.length === 2) ? arg[1] : true; | ||
@@ -38,0 +38,0 @@ // Finally add the argument to the args set |
@@ -34,7 +34,15 @@ # args-parser | ||
{ | ||
careful: undefined, | ||
dangerous: undefined, | ||
tomatoes: 3, | ||
tonight: undefined | ||
"careful": true, | ||
"dangerous": true, | ||
"tomatoes": 3, | ||
"tonight": true | ||
} | ||
``` | ||
So then you can easily check what you need: | ||
```javascript | ||
if (args.careful) { | ||
// Do something | ||
} | ||
``` |
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
14041
47