Page
このコンテンツはまだ日本語訳がありません。
Page:
object
Defined in: packages/core/src/types.ts:145
Companion object for the Page type. Provides transformation and factory utilities.
Type Declaration
Section titled “Type Declaration”empty()
Section titled “empty()”
readonlyempty: <T>() =>Page<T>
Create an empty page with no items.
Type Parameters
Section titled “Type Parameters”T
Returns
Section titled “Returns”Page<T>
an empty Page with hasMore=false
Idempotency
Section titled “Idempotency”Safe — pure function
readonlymap: <T,U>(page,fn) =>Page<U>
Transform items in a page while preserving pagination metadata.
Type Parameters
Section titled “Type Parameters”T
U
Parameters
Section titled “Parameters”Page<T>
the source page
(item) => U
mapping function applied to each item
Returns
Section titled “Returns”Page<U>
a new Page with transformed items
Postcondition
Section titled “Postcondition”cursor, total, and hasMore are preserved
Idempotency
Section titled “Idempotency”Safe — pure function
Example
Section titled “Example”const mapped = Page.map(page, (item) => item.id);const empty = Page.empty<Archive>();