Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kentcdodds/github

src/paginate.ts

16 lines · 568 B · TypeScript
import type { GitHubPaginateOptions } from "./types"
export { paginate } from "./core"
import { paginate } from "./core"

/**
 * Follow GitHub REST Link pagination for array endpoints.
 *
 * @returns Combined `items` from up to `maxPages` pages.
 * @example
 * import githubPaginate from 'kody:@kentcdodds/github/paginate'
 * const result = await githubPaginate({ account: 'bot', path: '/user/repos', maxPages: 2 })
 * // => { items: [...], pages: 2 }
 */
export default async function githubPaginate(params: GitHubPaginateOptions) {
  return await paginate(params)
}