Skip to content

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 Parameter
T
ParameterType
sourcereadonly T[]
limitbigint
getNextCursor(lastItem) => bigint

Page<T>