rozod 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +4 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -168,7 +168,8 @@ async function fetchApiPages(endpoint, initialParams, requestOptions, limit = 10
|
|
|
168
168
|
const allResults = [];
|
|
169
169
|
// eslint-disable-next-line no-constant-condition
|
|
170
170
|
while (true) {
|
|
171
|
-
const paramsWithCursor = { ...initialParams, cursor }
|
|
171
|
+
const paramsWithCursor = (cursor !== undefined && { ...initialParams, cursor }) ||
|
|
172
|
+
initialParams;
|
|
172
173
|
const response = await fetchApi(endpoint, paramsWithCursor, requestOptions);
|
|
173
174
|
allResults.push(response);
|
|
174
175
|
if ('nextPageCursor' in response) {
|
|
@@ -206,7 +207,8 @@ async function* fetchApiPagesGenerator(endpoint, initialParams, requestOptions,
|
|
|
206
207
|
let cursor;
|
|
207
208
|
// eslint-disable-next-line no-constant-condition
|
|
208
209
|
while (true) {
|
|
209
|
-
const paramsWithCursor = { ...initialParams, cursor }
|
|
210
|
+
const paramsWithCursor = (cursor !== undefined && { ...initialParams, cursor }) ||
|
|
211
|
+
initialParams;
|
|
210
212
|
const response = await fetchApi(endpoint, paramsWithCursor, requestOptions);
|
|
211
213
|
yield response;
|
|
212
214
|
if ('nextPageCursor' in response) {
|