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.
Files changed (2) hide show
  1. package/lib/index.js +4 -2
  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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rozod",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Wrapper for Roblox API using Zod and custom API Client using fetch",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",