{"id":18317934,"url":"https://github.com/idiocc/accepts","last_synced_at":"2025-10-09T08:21:56.345Z","repository":{"id":57113694,"uuid":"184980374","full_name":"idiocc/accepts","owner":"idiocc","description":"Higher-Level Content Negotiation In ES6 Optimised With Google Closure Compiler.","archived":false,"fork":false,"pushed_at":"2019-12-19T06:58:46.000Z","size":293,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-30T10:56:21.725Z","etag":null,"topics":["closure-compiler","idio"],"latest_commit_sha":null,"homepage":"https://www.idio.cc","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idiocc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-05T04:46:28.000Z","updated_at":"2019-12-19T06:58:49.000Z","dependencies_parsed_at":"2022-08-22T04:50:57.430Z","dependency_job_id":null,"html_url":"https://github.com/idiocc/accepts","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/idiocc/accepts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Faccepts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Faccepts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Faccepts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Faccepts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idiocc","download_url":"https://codeload.github.com/idiocc/accepts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idiocc%2Faccepts/sbom","scorecard":{"id":481399,"data":{"date":"2025-08-11","repo":{"name":"github.com/idiocc/accepts","commit":"d0d84419648c262d3ff1f3d2fd3e2522f7df2731"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU Affero General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T16:44:18.541Z","repository_id":57113694,"created_at":"2025-08-19T16:44:18.541Z","updated_at":"2025-08-19T16:44:18.541Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001100,"owners_count":26082991,"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-10-09T02:00:07.460Z","response_time":59,"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":["closure-compiler","idio"],"created_at":"2024-11-05T18:07:55.927Z","updated_at":"2025-10-09T08:21:56.320Z","avatar_url":"https://github.com/idiocc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @goa/accepts\n\n[![npm version](https://badge.fury.io/js/%40goa%2Faccepts.svg)](https://www.npmjs.com/package/@goa/accepts)\n\n`@goa/accepts` is a fork of \u003ckbd\u003e🏛 [Higher-Level Content Negotiation](https://github.com/jshttp/accepts/)\u003c/kbd\u003e In ES6 Optimised With [JavaScript Compiler](https://compiler.page).\n\n```sh\nyarn add @goa/accepts\n```\n\n## Table Of Contents\n\n- [Table Of Contents](#table-of-contents)\n- [API](#api)\n- [class Accepts](#class-accepts)\n  * [`constructor(req): Accepts`](#constructorreq-httpincomingmessage-accepts)\n- [Copyright \u0026 License](#copyright--license)\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/0.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n## API\n\nThe package is available by importing its default class:\n\n```js\nimport Accepts from '@goa/accepts'\n```\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/1.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n## class Accepts\n\nThe instances of this class allow to negotiate languages, charsets, encoding and types and additionally:\n\n- Allow types as an array or arguments list, i.e. `(['text/html', 'application/json'])` as well as `('text/html', 'application/json')`;\n- Allow type shorthands such as json;\n- Return false when no types match;\n- Treat non-existent headers as *.\n\n### \u003ccode\u003e\u003cins\u003econstructor\u003c/ins\u003e(\u003c/code\u003e\u003csub\u003e\u003cbr/\u003e\u0026nbsp;\u0026nbsp;`req: !http.IncomingMessage,`\u003cbr/\u003e\u003c/sub\u003e\u003ccode\u003e): \u003ci\u003eAccepts\u003c/i\u003e\u003c/code\u003e\n\nCreate a new Accepts object for the given request from a client.\n\n - \u003ckbd\u003e\u003cstrong\u003ereq*\u003c/strong\u003e\u003c/kbd\u003e \u003cem\u003e\u003ccode\u003e\u003ca href=\"https://nodejs.org/api/http.html#http_class_http_incomingmessage\" title=\"A readable stream that receives data from the client in chunks. The first argument of the http.Server.on(\u0026quot;request\u0026quot;) event.\"\u003e\u003cimg src=\".documentary/type-icons/node.png\" alt=\"Node.JS Docs\"\u003e!http.IncomingMessage\u003c/a\u003e\u003c/code\u003e\u003c/em\u003e: The request.\n\n```js\nimport Accepts from '@goa/accepts'\nimport { createServer } from 'http'\nimport aqt from '@rqt/aqt'\n\nfunction app(req, res) {\n  const accept = new Accepts(req)\n\n  // the order of this list is significant; should be server preferred order\n  switch (accept.type(['json', 'html'])) {\n  case 'json':\n    res.setHeader('Content-Type', 'application/json')\n    res.write('{\"hello\":\"world!\"}')\n    break\n  case 'html':\n    res.setHeader('Content-Type', 'text/html')\n    res.write('\u003cb\u003ehello, world!\u003c/b\u003e')\n    break\n  default:\n    // the fallback is text/plain, so no need to specify it above\n    res.setHeader('Content-Type', 'text/plain')\n    res.write('hello, world!')\n    break\n  }\n\n  res.end()\n}\n\nconst server = createServer(app)\nserver.listen(0, async () =\u003e {\n  const url = `http://localhost:${server.address().port}`\n  let { body, headers } = await aqt(url, {\n    headers: { 'accept': 'application/json' },\n  })\n  console.log('Response:', body, '\\tType:', headers['content-type'])\n  ;({ body, headers } = await aqt(url, {\n    headers: { 'accept': 'text/html' },\n  }))\n  console.log('Response:', body, '\\tType:', headers['content-type'])\n  ;({ body, headers } = await aqt(url, {\n    headers: { 'accept': 'text/plain' },\n  }))\n  console.log('Response:', body, '\\tType:', headers['content-type'])\n  server.close()\n})\n```\n```\nResponse: { hello: 'world!' } \tType: application/json\nResponse: \u003cb\u003ehello, world!\u003c/b\u003e \tType: text/html\nResponse: hello, world! \tType: text/plain\n```\n\n\u003ckbd\u003e[🔖 View all instance methods in Wiki](../../wiki/Accepts)\u003c/kbd\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/2.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n## Copyright \u0026 License\n\nGNU Affero General Public License v3.0\n\n[Original work, documentation and testing](https://github.com/jshttp/accepts) by Jonathan Ong and Douglas Christopher Wilson under MIT license found in [COPYING](COPYING).\n\n---\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://artd.eco\"\u003e\n        \u003cimg width=\"100\" src=\"https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png\"\n          alt=\"Art Deco\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e© \u003ca href=\"https://artd.eco\"\u003eArt Deco\u003c/a\u003e for \u003ca href=\"https://idio.cc\"\u003eIdio\u003c/a\u003e 2019\u003c/th\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://idio.cc\"\u003e\n        \u003cimg src=\"https://avatars3.githubusercontent.com/u/40834161?s=100\" width=\"100\" alt=\"Idio\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://www.technation.sucks\" title=\"Tech Nation Visa\"\u003e\n        \u003cimg width=\"100\" src=\"https://raw.githubusercontent.com/idiocc/cookies/master/wiki/arch4.jpg\"\n          alt=\"Tech Nation Visa\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e\u003ca href=\"https://www.technation.sucks\"\u003eTech Nation Visa Sucks\u003c/a\u003e\u003c/th\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/-1.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidiocc%2Faccepts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidiocc%2Faccepts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidiocc%2Faccepts/lists"}