fix faulty logic

This commit is contained in:
jane 2021-06-04 21:46:00 -04:00
parent 4c21cbf643
commit 3de793217b

View file

@ -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 {