{"id":13825767,"url":"https://github.com/bcomnes/header-pagination","last_synced_at":"2025-04-22T22:14:03.148Z","repository":{"id":36251446,"uuid":"222757256","full_name":"bcomnes/header-pagination","owner":"bcomnes","description":"Parse rfc5988 style pagination Link headers from a fetch Response object.","archived":false,"fork":false,"pushed_at":"2024-07-10T14:31:37.000Z","size":82,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T22:13:44.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.com/header-pagination","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bcomnes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/funding.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["bcomnes"],"custom":["https://bret.io"]}},"created_at":"2019-11-19T17:57:34.000Z","updated_at":"2024-07-10T14:31:39.000Z","dependencies_parsed_at":"2024-01-18T04:07:04.191Z","dependency_job_id":"b20e697f-4db7-4f33-b9f5-c1fe6a0954f6","html_url":"https://github.com/bcomnes/header-pagination","commit_stats":{"total_commits":56,"total_committers":3,"mean_commits":"18.666666666666668","dds":0.2857142857142857,"last_synced_commit":"4dfbe9b45421134685f5eca11e0dc14e5e1def5f"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fheader-pagination","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fheader-pagination/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fheader-pagination/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fheader-pagination/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcomnes","download_url":"https://codeload.github.com/bcomnes/header-pagination/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250331823,"owners_count":21413103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T09:01:26.742Z","updated_at":"2025-04-22T22:14:03.104Z","avatar_url":"https://github.com/bcomnes.png","language":"JavaScript","funding_links":["https://github.com/sponsors/bcomnes","https://bret.io"],"categories":["JavaScript"],"sub_categories":[],"readme":"# header-pagination\n[![Actions Status](https://github.com/bcomnes/header-pagination/workflows/tests/badge.svg)](https://github.com/bcomnes/header-pagination/actions)\n\nParse rfc5988 style pagination Link headers from a [`fetch`][fetch] [`Response`][response] object.\n\n```\nnpm install header-pagination\n```\n\n## Usage\n\n``` js\nimport { getPagination } from 'header-pagination'\n\nwindow.fetch(req).then(async response =\u003e {\n  const pagination = getPagination(response.headers)\n  // {\n  //    last,\n  //    next,\n  //    prev,\n  //    first,\n  //    current,\n  //    total (if X-Total-Count is included)\n  // }\n  const json = await response.json()\n  return {pagination, json}\n})\n```\n\n## API\n\n### `getPagination(response)`\n\nGiven a [`fetch`][fetch] [`Response`][response], returns an object with the following properties:\n\n```js\n{\n  last,\n  next,\n  prev,\n  first,\n  current,\n  total // if X-Total-Count is included\n}\n```\n\n## See also\n\n- [netlify/micro-api-client](https://github.com/netlify/micro-api-client): Extracted from netlify's Micro-api-client.\n- [developer.github.com/v3/#pagination](https://developer.github.com/v3/#pagination): Github style pagination.\n- [rfc5988-section 5][rfc5988]: Spec describing the use of `Link rel=` headers.\n\n## License\n\nMIT\n\n\n[response]: https://developer.mozilla.org/en-US/docs/Web/API/Response\n[fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API\n[rfc5988]: https://tools.ietf.org/html/rfc5988#section-5\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcomnes%2Fheader-pagination","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcomnes%2Fheader-pagination","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcomnes%2Fheader-pagination/lists"}