Support regular expressions that are strings in the query language

pull/925/head
Zef Hemel 2024-07-07 10:55:31 +02:00
parent ae2d636e80
commit a0ac6e66f9
1 changed files with 3 additions and 0 deletions

View File

@ -249,6 +249,9 @@ function evalSimpleExpression(type: string, val1: any, val2: any, val3: any) {
return val1 != val2;
}
case "=~": {
if (typeof val2 === "string") {
val2 = [val2, "i"];
}
if (!Array.isArray(val2)) {
throw new Error(`Invalid regexp: ${val2}`);
}