Skip to content

Commit

Permalink
Fix pagination example (#1209)
Browse files Browse the repository at this point in the history
* docs: fix pagination example

* docs: use Number
  • Loading branch information
jaulz authored May 1, 2020
1 parent 46cd61b commit 767d745
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ const got = require('got');
pagination: {
paginate: (response, allItems, currentItems) => {
const previousSearchParams = response.request.options.searchParams;
const {offset: previousOffset} = previousSearchParams;
const previousOffset = previousSearchParams.get('offset');

if (currentItems.length < limit) {
return false;
Expand All @@ -748,7 +748,7 @@ const got = require('got');
return {
searchParams: {
...previousSearchParams,
offset: previousOffset + limit,
offset: Number(previousOffset) + limit,
}
};
}
Expand Down

0 comments on commit 767d745

Please sign in to comment.