Skip to content

Commit

Permalink
Add more operators
Browse files Browse the repository at this point in the history
  • Loading branch information
easbittm committed Oct 13, 2021
1 parent ae4218c commit 2368140
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/CodeInterpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,26 @@ function BinaryExpression(node, rowName, context) {
result[left] = { $not: right };
return result;
}
if ([">="].includes(node.operator)) {
let result = {};
result[left] = { $gte: right };
return result;
}
if (["<="].includes(node.operator)) {
let result = {};
result[left] = { $lte: right };
return result;
}
if ([">"].includes(node.operator)) {
let result = {};
result[left] = { $gt: right };
return result;
}
if (["<"].includes(node.operator)) {
let result = {};
result[left] = { $lt: right };
return result;
}
throw new Error("Unkown operator:" + node.operator);
}

Expand Down

0 comments on commit 2368140

Please sign in to comment.