From 807b96deadbd211f9cfb2be66eb882487b3087ec Mon Sep 17 00:00:00 2001 From: Alan North Date: Mon, 27 May 2024 19:56:34 -0300 Subject: [PATCH] style: fix lint issues --- src/Parser.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Parser.ts b/src/Parser.ts index 15d7a4a..a6d1dfe 100644 --- a/src/Parser.ts +++ b/src/Parser.ts @@ -1,6 +1,5 @@ import { isArray } from "@alanscodelog/utils/isArray" import { isWhitespace } from "@alanscodelog/utils/isWhitespace" -import { last } from "@alanscodelog/utils/last" import { mixin } from "@alanscodelog/utils/mixin" import { setReadOnly } from "@alanscodelog/utils/setReadOnly" import type { AddParameters, Mixin } from "@alanscodelog/utils/types" @@ -345,12 +344,12 @@ export class Parser { const pairs: any[][] = [] as any let next = this.peek(1) - while (true) { + while (pairs.length < 1 || pairs[pairs.length - 1]?.[1] !== undefined) { const exp = type === "AND" ? this.ruleCondition() : this.ruleBool("AND") next = this.peek(1) const canAttemptErrorRecovery = type === "AND" - ? ["error", "and"].includes(this.options.onMissingBooleanOperator) - : this.options.onMissingBooleanOperator === "or" + ? ["error", "and"].includes(this.options.onMissingBooleanOperator) + : this.options.onMissingBooleanOperator === "or" const extras: any[] = [] if ( canAttemptErrorRecovery @@ -404,9 +403,6 @@ export class Parser { pairs[pairs.length - 1].splice(1, 1, extra[0]) pairs.push([extra[1]]) } - if (last(pairs)[1] === undefined) { - break - } } if (pairs.length === 0 && this.isType(this.peek(1), OP_TYPE)) {