From 2a2856e549ee2c4889f396f5b5e5a8554969ec0a Mon Sep 17 00:00:00 2001 From: solecki <38192622+solecki@users.noreply.github.com> Date: Sun, 15 Apr 2018 13:45:28 +0200 Subject: [PATCH] Fix if-statement causing a failing test --- lib/command.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/command.coffee b/lib/command.coffee index 4796523..71d2c22 100644 --- a/lib/command.coffee +++ b/lib/command.coffee @@ -128,10 +128,10 @@ class Command if off1? address1 += @parseOffset(off1) - inputIsNumber = /^\d+$/.test(cl) + commandProvided = /[$.\d+-]?[\,]?[$.\d+-]\w+$/g.test(cl) address1 = 0 if address1 is -1 - address1 = lastLine if address1 > lastLine and inputIsNumber + address1 = lastLine if address1 > lastLine and commandProvided if address1 < 0 or address1 > lastLine throw new CommandError('E16: Invalid range') @@ -142,7 +142,7 @@ class Command address2 += @parseOffset(off2) address2 = 0 if address2 is -1 - address2 = lastLine if address2 > lastLine and inputIsNumber + address2 = lastLine if address2 > lastLine and commandProvided if address2 < 0 or address2 > lastLine throw new CommandError('E16: Invalid range')