Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

http-response-status

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-response-status

HTTP Status Map in Typescript

  • 0.0.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
64
decreased by-94.89%
Maintainers
1
Weekly downloads
 
Created
Source

http-response-status

HTTP Status Map in Typescript

Build Status codecov

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installing

Using npm:

npm i --save http-response-status

Using yarn:

yarn add --dev http-response-status

Usage

Here are examples of how you can use http-response-status.

Check if it's a 200 OK

import { NHttpStatuses } from 'http-response-status'

const isOk = (httpCode: number) => {
  if (httpCode === NHttpStatuses.OK) {
    return true
  }

  return false
}

Get http status name

import { getHttpStatusName } from 'http-response-status'

const isOk = (httpCode: number) => {
  if (getHttpStatusName(httpCode) === 'OK') {
    return true
  }

  return false
}

Get http status category

import { HTTP_STATUS_SUCCESS, getHttpStatusCatgory } from 'http-response-status'

const isSuccess = (httpCode) => {
  if (getHttpStatusCatgory(httpCode) === HTTP_STATUS_SUCCESS) {
    return true
  }

  return false
}

Running the tests

Tests are written with jest

Type check

yarn run lint

Unit tests

yarn run test

Deployment

Deployment is done with Travis.

Built With

  • TSDX - TSDX

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

FAQs

Package last updated on 31 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc