Paginate
cartographer / paginate
Function: paginate()
Section titled “Function: paginate()”paginate<
T>(items,pageNumber,itemsPerPage):object
Defined in: queries/queryFunctions.ts:455
Paginate an array of items.
Type Parameters
Section titled “Type Parameters”T
Type of items in array
Parameters
Section titled “Parameters”T[]
Array of items to paginate
pageNumber
Section titled “pageNumber”number
Zero-indexed page number (clamped to valid range)
itemsPerPage
Section titled “itemsPerPage”number
Number of items per page
Returns
Section titled “Returns”object
- Object with paginated items, total pages, current page, and total item count
items:
T[]
totalPages
Section titled “totalPages”totalPages:
number
currentPage
Section titled “currentPage”currentPage:
number
totalItems
Section titled “totalItems”totalItems:
number
Example
Section titled “Example”const page = paginate(items, 0, 20);// { items: [item0...item19], totalPages: 5, currentPage: 0, totalItems: 100 }