Skip to content

Commit

Permalink
Fix docs being out of sync from #1645
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 6, 2021
1 parent 462bc63 commit 4cce4de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -1026,8 +1026,9 @@ Default: `false`

Defines how the property `allItems` in [`pagination.paginate`](#pagination.paginate), [`pagination.filter`](#pagination.filter) and [`pagination.shouldContinue`](#pagination.shouldContinue) is managed.

When set to `false`, the `allItems` parameter is always an empty array. If `true`, it can hugely increase memory usage when working with a large dataset.
By default, the property `allItems` is always an empty array. This setting can be helpful to save on memory usage when working with a large dataset.

When set to `true`, the property `allItems` is an array of the emitted items.

##### localAddress

Expand Down
10 changes: 5 additions & 5 deletions source/as-promise/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ export interface PaginationOptions<ElementType, BodyType> {
The function takes an object with the following properties:
- `response` - The current response object.
- `currentItems` - Items from the current response.
- `allItems` - An empty array, unless when `pagination.stackAllItems` is set to `true`. In the later case, an array of the emitted items.
- `allItems` - An empty array, unless `pagination.stackAllItems` is set to `true`, in which case, it's an array of the emitted items.
It should return an object representing Got options pointing to the next page.
The options are merged automatically with the previous request, therefore the options returned `pagination.paginate(...)` must reflect changes only.
If there are no more pages, `false` should be returned.
It should return an object representing Got options pointing to the next page. The options are merged automatically with the previous request, therefore the options returned `pagination.paginate(...)` must reflect changes only. If there are no more pages, `false` should be returned.
@example
```
Expand Down Expand Up @@ -126,11 +124,13 @@ export interface PaginationOptions<ElementType, BodyType> {
requestLimit?: number;

/**
Defines how the property `allItems` in pagination.paginate, pagination.filter and pagination.shouldContinue is managed.
Defines how the property `allItems` in `pagination.paginate`, `pagination.filter` and `pagination.shouldContinue` is managed.
By default, the property `allItems` is always an empty array. This setting can be helpful to save on memory usage when working with a large dataset.
When set to `true`, the property `allItems` is an array of the emitted items.
@default false
*/
stackAllItems?: boolean;
};
Expand Down

0 comments on commit 4cce4de

Please sign in to comment.