Fixed a freeze caused by an empty string in Query object
This commit is contained in:
@@ -27,7 +27,13 @@ export class Query {
|
|||||||
this.exclusions = tokens.exclude.text
|
this.exclusions = tokens.exclude.text
|
||||||
.map(this.formatToken)
|
.map(this.formatToken)
|
||||||
.filter(o => !!o.value)
|
.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 {
|
public segmentsToStr(): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user