MCPcopy Create free account
hub / github.com/TanStack/db / paginate

Function paginate

packages/db-collection-e2e/src/utils/helpers.ts:193–206  ·  view source on GitHub ↗
(
  array: Array<T>,
  options: { limit?: number; offset?: number } = {},
)

Source from the content-addressed store, hash-verified

191 * Paginate array
192 */
193export function paginate<T>(
194 array: Array<T>,
195 options: { limit?: number; offset?: number } = {},
196): Array<T> {
197 const { limit, offset = 0 } = options
198
199 let result = array.slice(offset)
200
201 if (limit !== undefined) {
202 result = result.slice(0, limit)
203 }
204
205 return result
206}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected