{"id":16698063,"url":"https://github.com/arlac77/fetch-link-util","last_synced_at":"2025-04-10T02:54:30.813Z","repository":{"id":37792869,"uuid":"273222651","full_name":"arlac77/fetch-link-util","owner":"arlac77","description":"helper to extract fetch link header values","archived":false,"fork":false,"pushed_at":"2025-04-06T00:06:19.000Z","size":2652,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T00:24:16.571Z","etag":null,"topics":["fetch","paging"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arlac77.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2020-06-18T11:41:07.000Z","updated_at":"2025-04-06T00:06:22.000Z","dependencies_parsed_at":"2023-09-23T04:53:50.143Z","dependency_job_id":"3f801ee6-7468-4108-a084-4879877d00ef","html_url":"https://github.com/arlac77/fetch-link-util","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Ffetch-link-util","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Ffetch-link-util/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Ffetch-link-util/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Ffetch-link-util/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arlac77","download_url":"https://codeload.github.com/arlac77/fetch-link-util/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248147404,"owners_count":21055540,"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":["fetch","paging"],"created_at":"2024-10-12T17:50:35.805Z","updated_at":"2025-04-10T02:54:30.790Z","avatar_url":"https://github.com/arlac77.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/fetch-link-util.svg)](https://www.npmjs.com/package/fetch-link-util)\n[![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html)\n[![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\\\u0026label\\\u0026labelColor=blue\\\u0026color=555555)](https://typescriptlang.org)\n[![bundlejs](https://deno.bundlejs.com/?q=fetch-link-util\\\u0026badge=detailed)](https://bundlejs.com/?q=fetch-link-util)\n[![downloads](http://img.shields.io/npm/dm/fetch-link-util.svg?style=flat-square)](https://npmjs.org/package/fetch-link-util)\n[![GitHub Issues](https://img.shields.io/github/issues/arlac77/fetch-link-util.svg?style=flat-square)](https://github.com/arlac77/fetch-link-util/issues)\n[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Farlac77%2Ffetch-link-util%2Fbadge\\\u0026style=flat)](https://actions-badge.atrox.dev/arlac77/fetch-link-util/goto)\n[![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![Known Vulnerabilities](https://snyk.io/test/github/arlac77/fetch-link-util/badge.svg)](https://snyk.io/test/github/arlac77/fetch-link-util)\n[![Coverage Status](https://coveralls.io/repos/arlac77/fetch-link-util/badge.svg)](https://coveralls.io/github/arlac77/fetch-link-util)\n\n# fetch-link-util\n\nhelper to extract fetch link header values (https://datatracker.ietf.org/doc/html/rfc8288)\n\n# Example\n\n```js\nimport { getHeaderLink } from \"fetch-link-util\";\n\nasync listAllBranches() {\n  let next = \"https://api.github.com/repos/arlac77/fetch-link-util/branches\";\n\n  do {\n    const response = await fetch(next);\n    const json = await response.json();\n\n    console.log(json.map(branch =\u003e branch.name));\n    next = getHeaderLink(response.headers);\n  } while (next);\n}\n```\n\n# API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### Table of Contents\n\n*   [getHeaderLink](#getheaderlink)\n    *   [Parameters](#parameters)\n\n## getHeaderLink\n\n*   **See**: \u003chttps://datatracker.ietf.org/doc/html/rfc8288\u003e\n\nDecodes link header and delivers one href entry.\n\n### Parameters\n\n*   `headers` **[Headers](https://developer.mozilla.org/docs/Web/HTML/Element/header)** as given by fetch response\n*   `rel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** of link to retrieve (optional, default `\"next\"`)\n\nReturns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** href for given rel\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```shell\nnpm install fetch-link-util\n```\n\n# license\n\nBSD-2-Clause\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farlac77%2Ffetch-link-util","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farlac77%2Ffetch-link-util","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farlac77%2Ffetch-link-util/lists"}