This package, `builtin-status-codes`, provides a direct mapping of HTTP status codes to their corresponding human-readable messages. It retrieves the latest standard codes directly from Node.js's built-in `http` module when running in a Node.js environment, ensuring accuracy and up-to-date information without external dependencies. For browser environments, it offers a pre-built, zero-dependency version, making it suitable for universal JavaScript applications. The current stable version is 3.0.0. Due to its direct sourcing from Node's core and the stable nature of HTTP status codes, its release cadence is typically infrequent, primarily updating when Node.js introduces new codes or when there are build tool chain updates. Its key differentiator is providing a consistent, minimal API for both Node.js and browser contexts, leveraging built-in capabilities where possible.
npm install builtin-status-codesVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing the status codes map, retrieving messages for specific numeric codes, and iterating through all available codes.
Review the package's GitHub repository or `CHANGELOG.md` for detailed migration instructions specific to the 3.0.0 release.
If a reverse lookup is needed, iterate `Object.entries(codes)` and build your own reverse map or search dynamically.
For the most current status codes in a browser environment, ensure your `builtin-status-codes` package is updated to the latest version and that your build process includes the most recent browser bundle.
Use `import codes from 'builtin-status-codes'` for ES Modules.
Access status messages using bracket notation with the numeric code, e.g., `codes[200]`.
Ensure `builtin-status-codes` is correctly installed (`npm install builtin-status-codes`) and imported. Verify that the status code you are trying to access is a valid HTTP status code.
No dependency data recorded yet.