Skip to content

Commit

Permalink
fix: escape all quotes instead of the first
Browse files Browse the repository at this point in the history
  • Loading branch information
pearj authored May 21, 2022
1 parent 5c2374a commit 2c4f4ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/query-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const anyOf = <A>(...dsl: Filter<A>[]): Filter<A> => dsl.reduce((p, c) =>
// this returns true if any are true.
export const oneOf = <A, K extends keyof A>(field: keyof A, ...vals: A[K][]): Filter<A> => anyOf(...vals.map(x => equals(field, x)));

const escapeQuotes = (str: string): string => str.replace("'", "\\'");
const escapeQuotes = (str: string): string => str.replace(/'/g, "\\'");
const prepareValue = (val: unknown): string => {
if (typeof val === "string") {
return `'${escapeQuotes(val ?? "")}'`;
Expand Down

0 comments on commit 2c4f4ca

Please sign in to comment.