OpenHands / frontend /src /utils /extract-next-page-from-link.ts
Backup-bdg's picture
Upload 565 files
b59aa07 verified
raw
history blame contribute delete
405 Bytes
/**
* Extracts the next page number from a GitHub API link header.
* @param link The GitHub API link header
* @returns The next page number or null if there is no next page
*/
export const extractNextPageFromLink = (link: string): number | null => {
const regex = /<[^>]*[?&]page=(\d+)(?:&[^>]*)?>; rel="next"/;
const match = link.match(regex);
return match ? parseInt(match[1], 10) : null;
};