Skip to content

Commit 807b96d

Browse files
committed
style: fix lint issues
1 parent dc27d0e commit 807b96d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/Parser.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { isArray } from "@alanscodelog/utils/isArray"
22
import { isWhitespace } from "@alanscodelog/utils/isWhitespace"
3-
import { last } from "@alanscodelog/utils/last"
43
import { mixin } from "@alanscodelog/utils/mixin"
54
import { setReadOnly } from "@alanscodelog/utils/setReadOnly"
65
import type { AddParameters, Mixin } from "@alanscodelog/utils/types"
@@ -345,12 +344,12 @@ export class Parser<T extends {} = {}> {
345344
const pairs: any[][] = [] as any
346345
let next = this.peek(1)
347346

348-
while (true) {
347+
while (pairs.length < 1 || pairs[pairs.length - 1]?.[1] !== undefined) {
349348
const exp = type === "AND" ? this.ruleCondition() : this.ruleBool("AND")
350349
next = this.peek(1)
351350
const canAttemptErrorRecovery = type === "AND"
352-
? ["error", "and"].includes(this.options.onMissingBooleanOperator)
353-
: this.options.onMissingBooleanOperator === "or"
351+
? ["error", "and"].includes(this.options.onMissingBooleanOperator)
352+
: this.options.onMissingBooleanOperator === "or"
354353
const extras: any[] = []
355354
if (
356355
canAttemptErrorRecovery
@@ -404,9 +403,6 @@ export class Parser<T extends {} = {}> {
404403
pairs[pairs.length - 1].splice(1, 1, extra[0])
405404
pairs.push([extra[1]])
406405
}
407-
if (last(pairs)[1] === undefined) {
408-
break
409-
}
410406
}
411407

412408
if (pairs.length === 0 && this.isType(this.peek(1), OP_TYPE)) {

0 commit comments

Comments
 (0)