From 8b758535699541c9e6d1a0a6bd21f95d06dd13d8 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Fri, 9 Nov 2018 03:12:48 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Provide=20default=20value=20to?= =?UTF-8?q?=20reduce=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 64040b3..e02b1c0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,7 +20,7 @@ export default function parseArguments( //Iterate through all command line arguments. When we have read both name and value, verify the argument for correctness. //Show error if a name has no value afterwards, or a value has no name in front of it. - const lastOption = args.reduce(parseArgument.bind(null, { spec, outputArgs, requiredOptions, shortToLongLookup })); + const lastOption = args.reduce(parseArgument.bind(null, { spec, outputArgs, requiredOptions, shortToLongLookup }), ''); // argumentName must be cleared to '' after the value is read, so if it is not an empty string, the value was missing if (lastOption !== '') {