Skip to content

TypeScript API / laikacms/storage / applyPagination

Function: applyPagination() ​

ts
function applyPagination<T>(items, pagination): T[];

In-memory pagination helper for storage impls that don't natively paginate (FS, R2 directory listings). Supports offset/limit and page/perPage; cursor forms (before/after) fall back to returning the full list.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
itemsreadonly T[]
pagination| { page: number; perPage?: number; } | { before?: string; perPage?: number; } | { after?: string; perPage?: number; } | { limit?: number; offset: number; } | undefined

Returns ​

T[]

Released under the MIT License.