pageFromLookahead
pageFromLookahead<
T>(source,limit,getNextCursor):Page<T>
Defined in: packages/synapse-core/src/pagination.ts:46
Convert a contract response fetched with limit + 1 into a bounded page.
The extra item is used only to detect whether another page exists. When it
does, the item is removed and getNextCursor derives the continuation
cursor from the last visible item.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
source | readonly T[] |
limit | bigint |
getNextCursor | (lastItem) => bigint |
Returns
Section titled “Returns”Page<T>