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

http-status-codes

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-status-codes - npm Package Compare versions

Comparing version 2.0.0-beta.8 to 2.0.0-beta.9

10

build/index.d.ts
import { StatusCodes, ReasonPhrases } from './codes';
/**
* Returns the reason phrase for the given status code.
* If the given status code does not exist, undefined is returned.
* If the given status code does not exist, an error is thrown.
*
* @param {number|string} statusCode The HTTP status code
* @returns {string|undefined} The associated reason phrase (e.g. "Bad Request", "OK")
* @returns {string} The associated reason phrase (e.g. "Bad Request", "OK")
* */
export declare function getReasonPhrase(statusCode: (number | string)): (string | undefined);
export declare function getReasonPhrase(statusCode: (number | string)): (string);
/**

@@ -15,5 +15,5 @@ * Returns the status code for the given reason phrase.

* @param {string} reasonPhrase The HTTP reason phrase (e.g. "Bad Request", "OK")
* @returns {string|undefined} The associated status code
* @returns {string} The associated status code
* */
export declare function getStatusCode(reasonPhrase: string): (number | undefined);
export declare function getStatusCode(reasonPhrase: string): (number);
/**

@@ -20,0 +20,0 @@ * @deprecated

@@ -904,9 +904,13 @@ module.exports =

* Returns the reason phrase for the given status code.
* If the given status code does not exist, undefined is returned.
* If the given status code does not exist, an error is thrown.
*
* @param {number|string} statusCode The HTTP status code
* @returns {string|undefined} The associated reason phrase (e.g. "Bad Request", "OK")
* @returns {string} The associated reason phrase (e.g. "Bad Request", "OK")
* */
function getReasonPhrase(statusCode) {
return statusCodeToReasonPhrase[statusCode.toString()];
var result = statusCodeToReasonPhrase[statusCode.toString()];
if (!result) {
throw new Error("Status code does not exist: " + statusCode);
}
return result;
}

@@ -918,6 +922,10 @@ /**

* @param {string} reasonPhrase The HTTP reason phrase (e.g. "Bad Request", "OK")
* @returns {string|undefined} The associated status code
* @returns {string} The associated status code
* */
function getStatusCode(reasonPhrase) {
return reasonPhraseToStatusCode[reasonPhrase];
var result = reasonPhraseToStatusCode[reasonPhrase];
if (!result) {
throw new Error("Reason phrase does not exist: " + reasonPhrase);
}
return result;
}

@@ -924,0 +932,0 @@ /**

{
"name": "http-status-codes",
"version": "2.0.0-beta.8",
"version": "2.0.0-beta.9",
"description": "Constants enumerating the HTTP status codes. Based on the Java Apache HttpStatus API.",

@@ -5,0 +5,0 @@ "scripts": {

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