@terminaldz/zrexpress-sdk / index / paginate
Function: paginate()
ts
function paginate<TItem, TBody>(
fetchPage,
body,
options?): AsyncGenerator<TItem, void, undefined>;Defined in: pagination.ts:38
Lazily iterate every item of a paged search. Requests advance from body.pageNumber (default 1; must be an integer >= 1 — the live server answers out-of-range pages with defaults instead of an error, which would silently duplicate page 1). Terminates on hasNext === false, on an empty page, or when the server echoes a different page than the one requested (advance guard against pathological/pinned paging).
Type Parameters
| Type Parameter |
|---|
TItem |
TBody extends PageRequest |
Parameters
| Parameter | Type |
|---|---|
fetchPage | (body) => Promise<PagedList<TItem>> |
body | TBody |
options | PaginateOptions |
Returns
AsyncGenerator<TItem, void, undefined>