Skip to content

Commit

Permalink
Merge pull request #125 from Eronmmer/master
Browse files Browse the repository at this point in the history
Fix for page options less than 1
  • Loading branch information
aravindnc authored Mar 26, 2021
2 parents 519cb1c + dc35770 commit e3af4f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function paginate(query, options, callback) {
offset = parseInt(options.offset, 10);
skip = offset;
} else if (Object.prototype.hasOwnProperty.call(options, 'page')) {
page = parseInt(options.page, 10);
page = parseInt(options.page, 10) < 1 ? 1 : parseInt(options.page, 10);
skip = (page - 1) * limit;
} else {
offset = 0;
Expand Down

0 comments on commit e3af4f9

Please sign in to comment.