From 3de793217b32ce076d783c369fb543f151084d9c Mon Sep 17 00:00:00 2001 From: Jane Petrovna Date: Fri, 4 Jun 2021 21:46:00 -0400 Subject: [PATCH] fix faulty logic --- parse.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/parse.js b/parse.js index 8f304e6..5bc4d69 100644 --- a/parse.js +++ b/parse.js @@ -23,9 +23,12 @@ export default function parse(data) { let match = functions[command]; if (match != undefined) { if ( - !(match.options["requires_arg1"] && arg1 != undefined) && - !(match.options["requires_arg2"] && arg2 != undefined) + (match.options["requires_arg1"] && arg1 == undefined) || + (match.options["requires_arg2"] && arg2 == undefined) ) { + errors.push(`error parsing line ${lineNumber}, invalid number of args`); + } + else { parsed.push( { command: command, @@ -34,9 +37,6 @@ export default function parse(data) { } ); } - else { - errors.push(`error parsing line ${lineNumber}, invalid number of args`); - } } } return {