A lightweight, dependency-free function to parse HTTP Cache-Control headers, extracted from the hapi.js Wreck HTTP client. Version 1.0.1 is stable but unmaintained since 2016. Key differentiator: returns a simple object with parsed directives, no frills. Simpler than dedicated HTTP caching libraries, but limited to basic parsing.
npm install parse-cache-controlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: parse a Cache-Control header string into an object of directives.
Consider using a maintained alternative like 'http-cache-semantics' or 'cache-control-parser'.
Parse numeric values manually, e.g., parseInt(parsed['max-age'], 10).
Trim input and remove extra spaces.
Expect only simple token values.
Use default import: import parseCacheControl from 'parse-cache-control'
Run: npm install parse-cache-control
Convert to number: Number(parsed['max-age'])
No dependency data recorded yet.