Skip to content

Commit

Permalink
#24 correction to demo number filter
Browse files Browse the repository at this point in the history
  • Loading branch information
sean committed Nov 4, 2018
1 parent 588cd17 commit 8ae8f96
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions .storybook/mocks/api/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ const buildGteExpression = (key, searchValue) => {
}
}
}
return {$gte: parseInt(searchValue)};
return {
$where: function () {
return parseInt(this[key]) >= parseInt(searchValue);
}
}
};

const buildGtExpression = (key, searchValue) => {
Expand All @@ -31,7 +35,11 @@ const buildGtExpression = (key, searchValue) => {
}
}
}
return {$gt: parseInt(searchValue)};
return {
$where: function () {
return parseInt(this[key]) > parseInt(searchValue);
}
}
};

const buildLteExpression = (key, searchValue) => {
Expand All @@ -42,7 +50,11 @@ const buildLteExpression = (key, searchValue) => {
}
}
}
return {$lte: parseInt(searchValue)};
return {
$where: function () {
return parseInt(this[key]) <= parseInt(searchValue);
}
}
};

const buildLtExpression = (key, searchValue) => {
Expand All @@ -53,7 +65,11 @@ const buildLtExpression = (key, searchValue) => {
}
}
}
return {$lt: parseInt(searchValue)};
return {
$where: function() {
return parseInt(this[key]) < parseInt(searchValue);
}
}
};

const buildEqExpression = (key, searchValue) => {
Expand Down

0 comments on commit 8ae8f96

Please sign in to comment.