A simple, lightweight JavaScript/TypeScript library that provides HTTP status codes as types and a handy dictionary with their descriptions.
npm install @koziolek/http-status-as-type
const {statusTexts} = require('@koziolek/http-status-as-type');
console.log(statusTexts[200]); // "OK"
import { statusTexts, HttpStatus } from '@koziolek/http-status-as-type';
function printStatus(status: HttpStatus) {
console.log(statusTexts[status]); // "OK"
}
All official status codes are supported.
(Feel free to extend the list as needed!)
To build the project:
npm run build
To run tests:
npm test
Contributions are welcome! Feel free to open issues or submit pull requests.
MIT