Fixed a freeze caused by an empty string in Query object

This commit is contained in:
Simon Cambier
2022-10-24 22:06:07 +02:00
parent ff5bc76e60
commit d62fff6ce4

View File

@@ -27,7 +27,13 @@ export class Query {
this.exclusions = tokens.exclude.text
.map(this.formatToken)
.filter(o => !!o.value)
this.segments = tokens.text.map(this.formatToken)
this.segments = tokens.text.reduce<QueryToken[]>((prev, curr) => {
const formatted = this.formatToken(curr)
if (formatted.value) {
prev.push(formatted)
}
return prev
}, [])
}
public segmentsToStr(): string {