{"id":15375556,"url":"https://github.com/etienne-martin/cache-control-parser","last_synced_at":"2026-04-06T06:31:48.484Z","repository":{"id":43839468,"uuid":"271848778","full_name":"etienne-martin/cache-control-parser","owner":"etienne-martin","description":"A humble cache-control parser.","archived":false,"fork":false,"pushed_at":"2026-02-09T18:00:25.000Z","size":273,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-09T19:52:28.960Z","etag":null,"topics":["cache","cache-control","headers","http","http-headers","javascript","nodejs","parser","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/etienne-martin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["etienne-martin"]}},"created_at":"2020-06-12T16:58:08.000Z","updated_at":"2026-02-09T18:00:40.000Z","dependencies_parsed_at":"2024-05-21T15:49:03.663Z","dependency_job_id":"b9be6a77-3539-4e08-a4a8-322ed3df84e8","html_url":"https://github.com/etienne-martin/cache-control-parser","commit_stats":{"total_commits":40,"total_committers":5,"mean_commits":8.0,"dds":0.575,"last_synced_commit":"8b1dd74522c6e65c437901bb80db8c97631e5726"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/etienne-martin/cache-control-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etienne-martin%2Fcache-control-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etienne-martin%2Fcache-control-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etienne-martin%2Fcache-control-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etienne-martin%2Fcache-control-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/etienne-martin","download_url":"https://codeload.github.com/etienne-martin/cache-control-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etienne-martin%2Fcache-control-parser/sbom","scorecard":{"id":384261,"data":{"date":"2025-08-11","repo":{"name":"github.com/etienne-martin/cache-control-parser","commit":"3a6bc628027afe26b2fa8b5005de6e05ae284cb0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"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/10 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":"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":"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":"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: 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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Info: no jobLevel write permissions found"],"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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/etienne-martin/cache-control-parser/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/etienne-martin/cache-control-parser/build.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"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":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"52 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-h9rv-jmmf-4pgx","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"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-18T16:13:54.036Z","repository_id":43839468,"created_at":"2025-08-18T16:13:54.036Z","updated_at":"2025-08-18T16:13:54.036Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31463012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"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":["cache","cache-control","headers","http","http-headers","javascript","nodejs","parser","typescript"],"created_at":"2024-10-01T14:03:59.550Z","updated_at":"2026-04-06T06:31:48.479Z","avatar_url":"https://github.com/etienne-martin.png","language":"TypeScript","funding_links":["https://github.com/sponsors/etienne-martin"],"categories":[],"sub_categories":[],"readme":"# cache-control-parser\n\nA humble [cache-control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) parser.\n\n[![Build status](https://github.com/etienne-martin/cache-control-parser/workflows/Build/badge.svg)](https://github.com/etienne-martin/cache-control-parser/actions)\n[![Coveralls github](https://img.shields.io/coveralls/github/etienne-martin/cache-control-parser.svg)](https://coveralls.io/github/etienne-martin/cache-control-parser)\n[![npm monthly downloads](https://img.shields.io/npm/dm/cache-control-parser.svg)](https://www.npmjs.com/package/cache-control-parser)\n\n## Features\n\n- Fault-tolerant\n- Case-insensitive\n- No dependencies\n- Built-in TypeScript support\n- Thoroughly tested\n\n✨ **New:** you can now stringify cache control objects\n\n## Getting Started\n\n### Installation\n\nTo use cache-control-parser in your project, run:\n\n```bash\nnpm install cache-control-parser\n```\n\n### Usage\n\n**Example** - parse a string of cache control directives into an object:\n\n```javascript\nimport { parse } from \"cache-control-parser\";\n\nconst directives = parse(\n  \"public, max-age=300, no-transform\"\n);\n\nconsole.log(directives);\n```\n\nOutput:\n\n```json\n{\n  \"public\": true,\n  \"max-age\": 300,\n  \"no-transform\": true\n}\n```\n\n**Example** - destructuring the cache control object:\n\n```javascript\nimport { parse } from \"cache-control-parser\";\n\nconst directives = parse(\n  \"max-age=300, s-maxage=0\"\n);\n\nconst { \"max-age\": maxAge, \"s-maxage\": sMaxAge } = directives;\n```\n\n**Example** - retrieve the shared proxy cache TTL:\n\n```javascript\nimport { parse } from \"cache-control-parser\";\n\nconst { \"max-age\": maxAge, \"s-maxage\": ttl = maxAge } = parse(\n  \"max-age=300, s-maxage=0\"\n);\n\nconsole.log(\"ttl:\", ttl);\n```\n\nOutput:\n\n```\nttl: 0\n```\n\n**Example** - stringify a cache control object:\n\n```javascript\nimport { stringify } from \"cache-control-parser\";\n\nconst cacheControl = stringify({\n  \"max-age\": 300,\n  \"s-maxage\": 3600,\n  \"public\": true\n});\n\nconsole.log(cacheControl);\n```\n\nOutput:\n\n```\nmax-age=300, s-maxage=3600, public\n```\n\n**Example** - Next.js API route response header:\n\n```typescript\nimport { stringify } from \"cache-control-parser\";\nimport type { NextApiRequest, NextApiResponse } from \"next\";\n\nexport default (req: NextApiRequest, res: NextApiResponse) =\u003e {\n  res.setHeader(\n    \"Cache-Control\",\n    stringify({\n      \"max-age\": 300,\n    })\n  );\n\n  res.send(\"Hello world\");\n};\n```\n\n## Supported Directives\n\n```\n{\n  \"max-age\"?: number;\n  \"s-maxage\"?: number;\n  \"stale-while-revalidate\"?: number;\n  \"stale-if-error\"?: number;\n  \"public\"?: boolean;\n  \"private\"?: boolean;\n  \"no-store\"?: boolean;\n  \"no-cache\"?: boolean;\n  \"must-revalidate\"?: boolean;\n  \"proxy-revalidate\"?: boolean;\n  \"immutable\"?: boolean;\n  \"no-transform\"?: boolean;\n}\n```\n\n## TypeScript\n\nType definitions are included in this library and exposed via:\n\n```typescript\nimport type { CacheControl } from \"cache-control-parser\";\n```\n\n## Built with\n\n- [node.js](https://nodejs.org/en/) - Cross-platform JavaScript run-time environment for executing JavaScript code server-side.\n- [TypeScript](https://www.typescriptlang.org/) - Typed superset of JavaScript that compiles to plain JavaScript.\n- [Jest](https://facebook.github.io/jest/) - Delightful JavaScript Testing.\n\n## Contributing\n\nWhen contributing to this project, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.\n\nUpdate the [README.md](https://github.com/etienne-martin/cache-control-parser/blob/main/README.md) with details of changes to the library.\n\nExecute `yarn test` and update the tests if needed.\n\n### Testing\n\nRun the full test suite:\n\n```bash\nyarn test\n```\n\nRun tests in watch mode:\n\n```bash\nyarn test:watch\n```\n\n## Authors\n\n- **Etienne Martin** - _Initial work_ - [etiennemartin.ca](https://etiennemartin.ca/)\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetienne-martin%2Fcache-control-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fetienne-martin%2Fcache-control-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetienne-martin%2Fcache-control-parser/lists"}