diff --git a/src/data/filter.ts b/src/data/filter.ts index 427cd34..948b437 100644 --- a/src/data/filter.ts +++ b/src/data/filter.ts @@ -39,10 +39,10 @@ export const renderCondition: Record s lte: infix('<='), gt: infix('>'), gte: infix('>='), - startswith: (l, r) => `startsWith(${l}, '${r}')`, - endswith: (l, r) => `endsWith(${l}, '${r}')`, - contains: (l, r) => `match(${l}, /${escapeStringRegexp(String(r))}/) != null`, - matches: (l, r) => `match(${l}, /${r}/) != null`, + startswith: (l, r) => `startswith(${l}, '${r || ''}')`, + endswith: (l, r) => `endswith(${l}, '${r || ''}')`, + contains: (l, r) => `match(${l}, /${escapeStringRegexp(String(r || ''))}/) != null`, + matches: (l, r) => r ? `match(${l}, /${r}/) != null` : null, }; export function isFilterComplete(f: Partial): f is Filter {