Skip to content

Commit

Permalink
fix string filters
Browse files Browse the repository at this point in the history
  • Loading branch information
thoughtspile committed Dec 27, 2023
1 parent 9fa41da commit d5a3fee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/data/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export const renderCondition: Record<Condition, (lhs: string, rhs: unknown) => 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<Filter>): f is Filter {
Expand Down

0 comments on commit d5a3fee

Please sign in to comment.