Socket
Socket
Sign inDemoInstall

is-redirect

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 2.0.0

17

index.js

@@ -1,14 +0,9 @@

'use strict';
module.exports = function (x) {
if (typeof x !== 'number') {
const redirectCodes = new Set([300, 301, 302, 303, 305, 307, 308]);
export default function isRedirect(statusCode) {
if (typeof statusCode !== 'number') {
throw new TypeError('Expected a number');
}
return x === 300 ||
x === 301 ||
x === 302 ||
x === 303 ||
x === 305 ||
x === 307 ||
x === 308;
};
return redirectCodes.has(statusCode);
}
{
"name": "is-redirect",
"version": "1.0.0",
"description": "Check if a number is a redirect HTTP status code",
"license": "MIT",
"repository": "sindresorhus/is-redirect",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js"
},
"files": [
"index.js"
],
"keywords": [
"redirect",
"http",
"https",
"status",
"code",
"codes",
"is",
"check",
"detect"
],
"devDependencies": {
"ava": "0.0.4"
}
"name": "is-redirect",
"version": "2.0.0",
"description": "Check if a number is a redirect HTTP status code",
"license": "MIT",
"repository": "sindresorhus/is-redirect",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"redirect",
"http",
"https",
"status",
"code",
"codes",
"is",
"check",
"detect"
],
"devDependencies": {
"ava": "^3.15.0",
"xo": "^0.38.2"
}
}

@@ -1,17 +0,15 @@

# is-redirect [![Build Status](https://travis-ci.org/sindresorhus/is-redirect.svg?branch=master)](https://travis-ci.org/sindresorhus/is-redirect)
# is-redirect
> Check if a number is a [redirect HTTP status code](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection)
> Check if a number is a [redirect HTTP status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection)
## Install
```
$ npm install --save is-redirect
$ npm install is-redirect
```
## Usage
```js
var isRedirect = require('is-redirect');
import isRedirect from 'is-redirect';

@@ -25,5 +23,17 @@ isRedirect(302);

## Related
## License
- [is-server-error](https://github.com/arthurvr/is-server-error)
- [is-success](https://github.com/arthurvr/is-success)
MIT © [Sindre Sorhus](http://sindresorhus.com)
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-is-redirect?utm_source=npm-is-redirect&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc