{"id":30066293,"url":"https://github.com/nlibjs/negotiate","last_synced_at":"2026-01-20T16:46:19.042Z","repository":{"id":54335509,"uuid":"522080227","full_name":"nlibjs/negotiate","owner":"nlibjs","description":"Utilities for content negotiation described in Section 5.3 of RFC 7231.","archived":false,"fork":false,"pushed_at":"2025-08-03T17:59:47.000Z","size":839,"stargazers_count":0,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-03T19:35:35.594Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nlibjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","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,"zenodo":null},"funding":{"github":"gjbkz","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2022-08-07T00:09:12.000Z","updated_at":"2025-07-22T09:35:22.000Z","dependencies_parsed_at":"2025-06-08T22:22:20.846Z","dependency_job_id":"d8a0d683-af92-4baf-b107-3d20a847a0c1","html_url":"https://github.com/nlibjs/negotiate","commit_stats":{"total_commits":85,"total_committers":3,"mean_commits":"28.333333333333332","dds":0.2705882352941177,"last_synced_commit":"3d958f6ab9840833287ed0aa7cbbb00b669e7393"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/nlibjs/negotiate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlibjs%2Fnegotiate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlibjs%2Fnegotiate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlibjs%2Fnegotiate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlibjs%2Fnegotiate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nlibjs","download_url":"https://codeload.github.com/nlibjs/negotiate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlibjs%2Fnegotiate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269383197,"owners_count":24408154,"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","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-08-08T07:28:36.750Z","updated_at":"2026-01-20T16:46:18.995Z","avatar_url":"https://github.com/nlibjs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/gjbkz"],"categories":[],"sub_categories":[],"readme":"# @nlib/negotiate\n\n[![.github/workflows/test.yml](https://github.com/nlibjs/negotiate/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/negotiate/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/nlibjs/negotiate/graph/badge.svg?token=uSsvlnhMEO)](https://codecov.io/gh/nlibjs/negotiate)\n\nUtilities for content negotiation described in [Section 5.3 of RFC 7231].\n\n[Section 5.3 of RFC 7231]: https://www.rfc-editor.org/rfc/rfc7231.html#section-5.3\n\n## negotiate\n\n```typescript\nconst supported = ['text/html', 'image/webp'];\nconst accept = 'text/html,image/avif,image/webp,image/apng,*/*;q=0.8';\nnegotiate(supported, accept); // → 'text/html'\nnegotiate([], accept); // → null\n```\n\n## parseAcceptStatements\n\n```typescript\nconst generator = parseAcceptStatements('v1,v2;q=0.9,v3;q=0.8');\ngenerator.next().value; // → {value: 'v1', q: 1}\ngenerator.next().value; // → {value: 'v2', q: 0.9}\ngenerator.next().value; // → {value: 'v3', q: 0.8}\ngenerator.next(); // → {value: undefined, done: true}\n```\n\n## parseNegotiationItem\n\n```typescript\nparseNegotiationItem('text/html;charset=utf-8;foo=1');\n// → {value: 'text/html', parameters: {charset: 'utf-8', foo: '1'}}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlibjs%2Fnegotiate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnlibjs%2Fnegotiate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlibjs%2Fnegotiate/lists"}