Comparing version 1.0.4 to 1.1.0
@@ -1,4 +0,4 @@ | ||
var http = require('http'); | ||
var codes = http.STATUS_CODES; | ||
var codes = require('./codes'); | ||
module.exports = status; | ||
@@ -53,3 +53,3 @@ | ||
if (!isNaN(n)) { | ||
if (!status[n]) return new Error('invalid status code: ' + n); | ||
if (!status[n]) throw new Error('invalid status code: ' + n); | ||
return n; | ||
@@ -56,0 +56,0 @@ } |
{ | ||
"name": "statuses", | ||
"description": "HTTP status utility", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"author": { | ||
@@ -19,4 +19,16 @@ "name": "Jonathan Ong", | ||
"files": [ | ||
"index.js" | ||
] | ||
"index.js", | ||
"codes.json", | ||
"LICENSE" | ||
], | ||
"devDependencies": { | ||
"mocha": "1", | ||
"istanbul": "0" | ||
}, | ||
"scripts": { | ||
"update": "node update.js", | ||
"test": "mocha --reporter spec --bail --check-leaks", | ||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks", | ||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks" | ||
} | ||
} |
# Statuses | ||
[![NPM version][npm-image]][npm-url] | ||
[![Dependency Status][david-image]][david-url] | ||
[![License][license-image]][license-url] | ||
[![Downloads][downloads-image]][downloads-url] | ||
[![NPM Version][npm-image]][npm-url] | ||
[![NPM Downloads][downloads-image]][downloads-url] | ||
[![Node.js Version][node-version-image]][node-version-url] | ||
[![Build Status][travis-image]][travis-url] | ||
[![Test Coverage][coveralls-image]][coveralls-url] | ||
@@ -77,17 +78,22 @@ HTTP status utility for node. | ||
[npm-image]: https://img.shields.io/npm/v/statuses.svg?style=flat-square | ||
### statuses/codes.json | ||
```js | ||
var codes = require('statuses/codes.json'); | ||
``` | ||
This is a JSON file of the status codes | ||
taken from `require('http').STATUS_CODES`. | ||
This is saved so that codes are consistent even in older node.js versions. | ||
For example, `308` will be added in v0.12. | ||
[npm-image]: https://img.shields.io/npm/v/statuses.svg?style=flat | ||
[npm-url]: https://npmjs.org/package/statuses | ||
[github-tag]: http://img.shields.io/github/tag/jshttp/statuses.svg?style=flat-square | ||
[github-url]: https://github.com/jshttp/statuses/tags | ||
[travis-image]: https://img.shields.io/travis/jshttp/statuses.svg?style=flat-square | ||
[node-version-image]: http://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat | ||
[node-version-url]: http://nodejs.org/download/ | ||
[travis-image]: https://img.shields.io/travis/jshttp/statuses.svg?style=flat | ||
[travis-url]: https://travis-ci.org/jshttp/statuses | ||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg?style=flat-square | ||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg?style=flat | ||
[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master | ||
[david-image]: http://img.shields.io/david/jshttp/statuses.svg?style=flat-square | ||
[david-url]: https://david-dm.org/jshttp/statuses | ||
[license-image]: http://img.shields.io/npm/l/statuses.svg?style=flat-square | ||
[license-url]: LICENSE | ||
[downloads-image]: http://img.shields.io/npm/dm/statuses.svg?style=flat-square | ||
[downloads-image]: http://img.shields.io/npm/dm/statuses.svg?style=flat | ||
[downloads-url]: https://npmjs.org/package/statuses | ||
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square | ||
[gittip-url]: https://www.gittip.com/jonathanong/ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
7042
5
99
0
2
50