From 384fee411209873f01868aa07998799db875a7d1 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Sun, 4 Nov 2018 16:59:18 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Be=20explicit=20in=20parsing=20r?= =?UTF-8?q?egexp=20match=20result?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/parseSpecEntry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parseSpecEntry.ts b/src/parseSpecEntry.ts index 2806925..03160ff 100644 --- a/src/parseSpecEntry.ts +++ b/src/parseSpecEntry.ts @@ -5,7 +5,7 @@ export default function parseSpecEntry({ outputArgs, requiredOptions, shortToLon if (longOption === '') { throw new Error(`The long option may not be an empty string. This is a bug in the source code of the script that you tried to call.`); } - if (!longOption.match(/^[a-z0-9]+(-[a-z0-9]+)*$/)) { + if (longOption.match(/^[a-z0-9]+(?:-[a-z0-9]+)*$/) === null) { throw new Error(`The long option "${longOption}" must only contain alpha-numeric characters, optionally separated by hyphens. This is a bug in the source code of the script that you tried to call.`); }