status-code-enum is a TypeScript enum that provides a comprehensive collection of standard HTTP status codes. It is currently at version 1.0.0, indicating a stable API suitable for production use. The package utilizes `semantic-release`, suggesting a consistent, automated release cadence driven by commit messages; new versions are published as features or fixes are introduced rather than on a fixed calendar schedule. Its primary differentiation is its direct provision of these codes as a robust TypeScript enum, offering strong type safety and auto-completion benefits within TypeScript projects. This makes it a reliable and convenient alternative to using magic numbers or manually defining constants for HTTP responses. This approach significantly enhances code readability and maintainability by eliminating the need for developers to remember specific numeric codes or to repeatedly define them across various projects. The enum covers informational, success, redirection, client error, and server error codes as defined by HTTP standards.
npm install status-code-enumVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import the `StatusCode` enum and assign its members to a hypothetical HTTP response object's status code, showcasing type-safe access to common HTTP codes.
Refer to official IETF RFCs for a complete list of all possible HTTP status codes, including experimental ones, if `status-code-enum` does not contain a specific code you require.
Treat the `StatusCode` enum as an immutable set of predefined values. If custom status codes are needed, define them separately rather than attempting to extend this enum.
Ensure you are using `import { StatusCode } from 'status-code-enum';` for ESM/TypeScript or `const { StatusCode } = require('status-code-enum');` for CommonJS.Correct the spelling of the enum member. Use IDE auto-completion to ensure the correct member name is used (e.g., `StatusCode.ClientErrorBadRequest`).
No dependency data recorded yet.