Skip to content

Fixing issue with number comparison #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ function __hierarchize(obj, dottedPath) {
return '';
}
// support comparison for Date/DateString
if(utils.isDate(res)) res = res.valueOf()
/*if(utils.isDate(res)) res = res.valueOf()
else if(utils.isDateString(res)) res = utils.parseDateFromString(res)
else res = res.toString()
else res = res.toString()*/

return res
return res.toString();
}

function FilterOR(ASTNode, row) {
Expand Down Expand Up @@ -241,13 +241,13 @@ function Filter(ASTNode, row) {
} else if (ASTNode.nreq) { // ~
return !__contains(__hierarchize(row, ASTNode.nreq[0]), ASTNode.nreq[1]);
} else if (ASTNode.gt) { // >
return __hierarchize(row, ASTNode.gt[0]) > ASTNode.gt[1];
return parseFloat(__hierarchize(row, ASTNode.gt[0])) > parseFloat(ASTNode.gt[1]);
} else if (ASTNode.ge) { // >=
return __hierarchize(row, ASTNode.ge[0]) >= ASTNode.ge[1];
return parseFloat(__hierarchize(row, ASTNode.ge[0])) >= parseFloat(ASTNode.ge[1]);
} else if (ASTNode.lt) { // <
return __hierarchize(row, ASTNode.lt[0]) < ASTNode.lt[1];
return parseFloat(__hierarchize(row, ASTNode.lt[0])) < parseFloat(ASTNode.lt[1]);
} else if (ASTNode.le) { // <=
return __hierarchize(row, ASTNode.le[0]) <= ASTNode.le[1];
return parseFloat(__hierarchize(row, ASTNode.le[0])) <= parseFloat(ASTNode.le[1]);
} else {
return Filter(ASTNode, row);
}
Expand Down