Skip to content

Commit

Permalink
condition should not be negative
Browse files Browse the repository at this point in the history
  • Loading branch information
calidion committed Jun 23, 2016
1 parent 2f31afb commit 5872ee4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@ export default {
var self = this;
return function (item, next) {
var imageCondition = self._getImageCondition(data, results, item, idx, next);
var fieldName = data.fieldName || 'image';
data.imageModel
.find(imageCondition)
.populate(fieldName)
.sort(fieldName + ' desc')
.exec(self._onFetchImage(results, idx, next));
// if the condition is negative, then the function next has been returned
if (imageCondition) {
var fieldName = data.fieldName || 'image';
data.imageModel
.find(imageCondition)
.populate(fieldName)
.sort(fieldName + ' desc')
.exec(self._onFetchImage(results, idx, next));
}
};
},

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "waterline-paginator",
"version": "0.0.5",
"version": "0.0.6",
"description": "paginator for waterline models",
"homepage": "",
"author": {
Expand Down

0 comments on commit 5872ee4

Please sign in to comment.