Skip to content

Commit

Permalink
improve query parser
Browse files Browse the repository at this point in the history
  • Loading branch information
dvargas92495 committed Mar 10, 2022
1 parent 0c56fd0 commit b780900
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/parseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ const parseQuery = (q: string[]) => {
const conditionNodes = conditions
.filter((s) => !s.startsWith("Select"))
.map((c) => {
const [source, rest] = c.split(/ (.+)/);
const relation = conditionLabels.find((l) => rest.startsWith(l)) || "";
const target = rest.substring(relation.length + 1);
const relation = conditionLabels.find((l) => c.includes(` ${l} `)) || "";
const [source, target] = c.split(` ${relation} `);
return {
source,
relation,
Expand Down

0 comments on commit b780900

Please sign in to comment.