Add lower() function to filter for case-insensitive comparison

pull/147/head
Candid Dauth 2021-04-10 00:27:08 +02:00
rodzic cc81bbdcba
commit 51ef12f9fe
2 zmienionych plików z 16 dodań i 3 usunięć

Wyświetl plik

@ -45,13 +45,13 @@
<tr>
<td><code>typeId</code></td>
<td><span v-for="(type, idx) in types"><span v-if="idx != 0"> / </span> <code>{{type.id}}</code> ({{type.name}})</span></td>
<td><code>typeId == 1</code></td>
<td><code>typeId == {{types[0].id || 1}}</code></td>
</tr>
<tr>
<td><code>data.&lt;field&gt;</code> / <code>prop(data, &lt;field&gt;)</code></td>
<td>Field values (example: <code>data.Description</code> or <code>prop(data, &quot;Description&quot;)</code></td>
<td><code>data.Description ~= &quot;camp&quot;</code></td>
<td><code>lower(data.Description) ~= &quot;camp&quot;</code></td>
</tr>
<tr>
@ -180,6 +180,12 @@
<td><code>name ~= &quot;^[Cc]amp$&quot;</code></td>
</tr>
<tr>
<td><code>lower()</code></td>
<td>Convert to lower case</td>
<td><code>lower(name) ~= &quot;untitled&quot;</code></td>
</tr>
<tr>
<td><code>ceil()</code>, <code>floor()</code>, <code>round()</code></td>
<td>Round (<code>ceil</code>: up, <code>floor</code>: down)</td>

Wyświetl plik

@ -9,7 +9,14 @@ const customFuncs = {
return obj && getProperty(obj, key);
},
random() { } // Does not work well with angular digest cycles
random() { }, // Does not work well with angular digest cycles
lower(obj: any) {
if (typeof obj == "string")
return obj.toLowerCase();
else
return obj;
}
};
export function filterHasError(expr: string): Error | undefined {