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