From 767d74534775393598a0ec267e6c9467a7563119 Mon Sep 17 00:00:00 2001 From: Julian Hundeloh Date: Fri, 1 May 2020 02:34:30 +0200 Subject: [PATCH] Fix pagination example (#1209) * docs: fix pagination example * docs: use Number --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 9dae27853..5efb6ed9e 100644 --- a/readme.md +++ b/readme.md @@ -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; @@ -748,7 +748,7 @@ const got = require('got'); return { searchParams: { ...previousSearchParams, - offset: previousOffset + limit, + offset: Number(previousOffset) + limit, } }; }