# http-status-series

> Utility to check http status codes

Latest version **1.0.1** (published 2016-03-08) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install http-status-series
pnpm add http-status-series
yarn add http-status-series
bun add http-status-series
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-03-08 |
| First published | 2016-03-08 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Bill Thornton |
| Maintainers | billtron |
| Keywords | http, status, series |

## Links

- npm: https://www.npmjs.com/package/http-status-series
- Repository: https://github.com/ExclamationLabs/http-status-series
- Issues: https://github.com/ExclamationLabs/http-status-series/issues
- npm.io page: https://npm.io/package/http-status-series

## Recent versions

- 1.0.1 (latest) — 2016-03-08
- 1.0.0 — 2016-03-08

## README

HTTP Status Series
==================
A simple utility for checking HTTP status codes.

Inspired by `HttpStatus` in the [Spring Framework](https://spring.io/).

Install
-------
```js
npm install http-status-series
```

API
---

### Constants

| Constant      | Value |
|---------------|-------|
| INFORMATIONAL |   1   |
| SUCCESSFUL    |   2   |
| REDIRECTION   |   3   |
| CLIENT_ERROR  |   4   |
| SERVER_ERROR  |   5   |

### Methods

#### getSeries(statusCode)
Returns the series of the statusCode.

##### Example
```js
httpStatus.getSeries(200) => 2
```

#### isInformational(statusCode)
Returns `true` if the HTTP status series is informational (1XX).

##### Example
```js
httpStatus.isInformational(100)   => true
httpStatus.isInformational("100") => true
httpStatus.isInformational(200)   => false
httpStatus.isInformational("200") => false
```

#### isSuccessful(statusCode)
Returns `true` if the HTTP status series is successful (2XX).

##### Example
```js
httpStatus.isSuccessful(200)   => true
httpStatus.isSuccessful("200") => true
httpStatus.isSuccessful(301)   => false
httpStatus.isSuccessful("301") => false
```

#### isRedirection(statusCode)
Returns `true` if the HTTP status series is a redirection (3XX).

##### Example
```js
httpStatus.isRedirection(301)   => true
httpStatus.isRedirection("301") => true
httpStatus.isRedirection(404)   => false
httpStatus.isRedirection("404") => false
```

#### isClientError(statusCode)
Returns `true` if the HTTP status series is a client error (4XX).

##### Example
```js
httpStatus.isClientError(404)   => true
httpStatus.isClientError("404") => true
httpStatus.isClientError(500)   => false
httpStatus.isClientError("500") => false
```

#### isServerError(statusCode)
Returns `true` if the HTTP status series is a server error (5XX).

##### Example
```js
httpStatus.isServerError(500)   => true
httpStatus.isServerError("500") => true
httpStatus.isServerError(404)   => false
httpStatus.isServerError("404") => false
```

License
-------

HTTP Status Series is licensed with [The BSD 2-Clause License](LICENSE.md)

---
_Source: https://npm.io/package/http-status-series · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
