Comparing version 4.1.0 to 4.1.1
const flagSymbol = Symbol('arg flag'); | ||
function arg(opts, {argv, permissive = false, stopAtPositional = false} = {}) { | ||
function arg(opts, {argv = process.argv.slice(2), permissive = false, stopAtPositional = false} = {}) { | ||
if (!opts) { | ||
@@ -10,4 +10,2 @@ throw new Error('Argument specification object is required'); | ||
argv = argv || process.argv.slice(2); | ||
const aliases = {}; | ||
@@ -79,3 +77,3 @@ const handlers = {}; | ||
const arg = separatedArguments[j]; | ||
const [originalArgName, argStr] = arg[1] === '-' ? arg.split('=', 2) : [arg, undefined]; | ||
const [originalArgName, argStr] = arg[1] === '-' ? arg.split(/=(.*)/, 2) : [arg, undefined]; | ||
@@ -82,0 +80,0 @@ let argName = originalArgName; |
{ | ||
"name": "arg", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "Another simple argument parser", | ||
@@ -21,3 +21,4 @@ "main": "index.js", | ||
"complexity": 0, | ||
"max-depth": 0 | ||
"max-depth": 0, | ||
"no-div-regex": 0 | ||
} | ||
@@ -24,0 +25,0 @@ }, |
@@ -37,4 +37,4 @@ # Arg [![CircleCI](https://circleci.com/gh/zeit/arg.svg?style=svg)](https://circleci.com/gh/zeit/arg) | ||
// `argument_array` is an optional parameter | ||
const args = arg(spec, options = {permissive: false, argv: process.argv.slice(2)}]); | ||
// `options` is an optional parameter | ||
const args = arg(spec, options = {permissive: false, argv: process.argv.slice(2)}); | ||
``` | ||
@@ -96,3 +96,3 @@ | ||
2. The parameter name (e.g. `--label`) | ||
3. The previous value for the destination (useful for reduce-like operatons or for supporting `-v` multiple times, etc.) | ||
3. The previous value for the destination (useful for reduce-like operations or for supporting `-v` multiple times, etc.) | ||
@@ -99,0 +99,0 @@ This means the built-in `String`, `Number`, and `Boolean` type constructors "just work" as type functions. |
12598
127