Socket
Socket
Sign inDemoInstall

is-ip

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-ip - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

license

16

index.js
'use strict';
var ipRegex = require('ip-regex');
const ipRegex = require('ip-regex');
var ip = module.exports = function (str) {
return ipRegex({exact: true}).test(str);
};
ip.v4 = function (str) {
return ipRegex.v4({exact: true}).test(str);
};
ip.v6 = function (str) {
return ipRegex.v6({exact: true}).test(str);
};
const isIp = module.exports = x => ipRegex({exact: true}).test(x);
isIp.v4 = x => ipRegex.v4({exact: true}).test(x);
isIp.v6 = x => ipRegex.v6({exact: true}).test(x);
{
"name": "is-ip",
"version": "1.0.0",
"version": "2.0.0",
"description": "Check if a string is an IP address",

@@ -10,9 +10,9 @@ "license": "MIT",

"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"scripts": {
"test": "node test.js"
"test": "xo && ava"
},

@@ -23,3 +23,5 @@ "files": [

"keywords": [
"text",
"ip",
"ipv6",
"ipv4",
"regex",

@@ -31,4 +33,4 @@ "regexp",

"find",
"text",
"pattern",
"ip",
"internet",

@@ -38,2 +40,3 @@ "protocol",

"validate",
"detect",
"check",

@@ -44,7 +47,11 @@ "is",

"dependencies": {
"ip-regex": "^1.0.0"
"ip-regex": "^2.0.0"
},
"devDependencies": {
"ava": "0.0.4"
"ava": "*",
"xo": "*"
},
"xo": {
"esnext": true
}
}

@@ -8,3 +8,3 @@ # is-ip [![Build Status](https://travis-ci.org/sindresorhus/is-ip.svg?branch=master)](https://travis-ci.org/sindresorhus/is-ip)

```sh
```
$ npm install --save is-ip

@@ -17,3 +17,3 @@ ```

```js
var isIp = require('is-ip');
const isIp = require('is-ip');

@@ -33,17 +33,22 @@ isIp('192.168.0.1');

### isIp(string)
### isIp(input)
Check if a string is IPv4 or IPv6.
Check if `input` is IPv4 or IPv6.
### isIp.v4(string)
### isIp.v4(input)
Check if a string is IPv4.
Check if `input` is IPv4.
### isIp.v6(string)
### isIp.v6(input)
Check if a string is IPv6.
Check if `input` is IPv6.
## Related
- [ip-regex](https://github.com/sindresorhus/ip-regex) - Regular expression for matching IP addresses
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)
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