• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
nbbaier

nbbaier

utilities

Public
Like
utilities
Home
Code
10
pagination
3
types
1
urlTools
2
README.md
archiveVal.ts
checkValName.ts
countArray.ts
divideNumberEqually
emptyValUtils.ts
filterObject
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
pagination
/
readme.md
Code
/
pagination
/
readme.md
Search
2/9/2025
Viewing readonly version of main branch: v75
View latest version
readme.md

Pagination Utilities

Fetch Paginated Data

This val exports a function that loops through paginated API responses and returns the combined data as an array. It expects pagination with next and there to be a data property in the API response. This conforms to the Val Town API, so this function is useful when fetching paginated Val Town API responses for creating custom folders in pomdtr's vscode extension.

Usage:

Create val
const id = <vt user id> await fetchPaginatedData(`https://api.val.town/v1/users/${id}/vals`, { headers: { Authorization: `Bearer ${Deno.env.get("valtown")}` }, });

For demo usage in the context of the vscode extension see this val.

Return a paginated response

A helper function to take an array and return a paginated response. This is useful when defining one's own folders for pomdtr's vscode extension.

Usage:

Create val
const data = [...] export default async function(req: Request): Promise<Response> { return paginatedResponse(req, data); }

For demo usage in the context of the vscode extension see this val.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.