Skip to content

Commit

Permalink
use case insensitive search if direct reference fails
Browse files Browse the repository at this point in the history
  • Loading branch information
dvargas92495 committed Apr 6, 2022
1 parent 5cb1567 commit fcaea76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/conditionToDatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ export const getConditionLabels = () =>
const conditionToDatalog: typeof window.roamjs.extension.queryBuilder.conditionToDatalog =
(con) => {
const { not, relation, ...condition } = con as QBClauseData;
const datalog = translator[relation]?.callback?.(condition) || [];
const datalogTranslator = translator[relation] || Object.entries(translator).find(([k]) => new RegExp(relation, 'i').test(k))?.[1];
const datalog = datalogTranslator?.callback?.(condition) || [];
if (datalog.length && not)
return [{ type: "not-clause", clauses: datalog }];
return datalog;
Expand Down

0 comments on commit fcaea76

Please sign in to comment.