{"id":49395198,"url":"https://github.com/flesch/stages","last_synced_at":"2026-04-28T15:46:49.014Z","repository":{"id":57369292,"uuid":"155408948","full_name":"flesch/stages","owner":"flesch","description":"A small utility to parse the `Accept` request header into an array of \"stages\".","archived":false,"fork":false,"pushed_at":"2018-10-30T15:35:27.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T16:46:34.202Z","etag":null,"topics":["accept","feature","header","javascript","node","npm","preview","request","stage","toggle"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/stages","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/flesch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-30T15:26:59.000Z","updated_at":"2018-10-30T15:39:05.000Z","dependencies_parsed_at":"2022-09-03T19:01:17.126Z","dependency_job_id":null,"html_url":"https://github.com/flesch/stages","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/flesch/stages","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flesch%2Fstages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flesch%2Fstages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flesch%2Fstages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flesch%2Fstages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flesch","download_url":"https://codeload.github.com/flesch/stages/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flesch%2Fstages/sbom","scorecard":{"id":403068,"data":{"date":"2025-08-11","repo":{"name":"github.com/flesch/stages","commit":"7d2cd1bedd5f612dbbc5d4e450b6ba3d98e28b0f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/1 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":"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":"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":"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":"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":"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":"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.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp"],"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-18T20:31:59.957Z","repository_id":57369292,"created_at":"2025-08-18T20:31:59.957Z","updated_at":"2025-08-18T20:31:59.957Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32387923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["accept","feature","header","javascript","node","npm","preview","request","stage","toggle"],"created_at":"2026-04-28T15:46:48.257Z","updated_at":"2026-04-28T15:46:48.994Z","avatar_url":"https://github.com/flesch.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stages\n\nThis is a small utility to parse the `Accept` header into an array of \"stages\", allowing a client to opt-in to functionality, like [GitHub uses in the GraphQL API](https://developer.github.com/v4/previews/).\n\n### Install\n\n```shell\n$ npm install --save stages\n```\n\n### Usage\n\n#### `stages(acceptHeaderString, regexPattern)`\n\n**stages** accepts two arguments: the `Accept` header string, and a pattern to match against.\n\n```js\nconst stages = require('stages');\n\nconst accept = '*/*,application/vnd.github.antiope-preview+json,application/vnd.github.echo-preview+json';\nconst pattern = /application\\/vnd\\..*\\.(.*)\\+json/;\n\nconsole.log(stages(accept, pattern)); // ==\u003e ['antiope-preview', 'echo-preview']\n```\n\nUse **stages** in an Express app:\n\n```diff\n  const express = require('express');\n+ const stages = require('stages');\n  const app = express();\n+ app.use((req, res, next) =\u003e {\n+   req.stages = stages(req.headers.accept, /application\\/vnd\\..*\\.(.*)\\+json/);\n+   next();\n+ });\n  app.get('/', (req, res, next) =\u003e {\n-   return res.send('Hello');\n+   if (req.stages.includes('echo-preview')) {\n+     return res.send(`The \u003ccode\u003eecho-preview\u003c/code\u003e stage is enabled!`);\n+   }\n+   res.send(req.stages.length ? `The stages enabled are: ${req.stages.join(', ')}` : `No stages are enabled!`);\n  });\n  app.listen(3000);\n+ // curl --header \"Accept: application/vnd.github.echo-preview+json\" http://localhost:3000/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflesch%2Fstages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflesch%2Fstages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflesch%2Fstages/lists"}