Comparing version
'use strict'; | ||
const ipRegex = require('ip-regex'); | ||
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); | ||
const isIp = string => ipRegex({exact: true}).test(string); | ||
isIp.v4 = string => ipRegex.v4({exact: true}).test(string); | ||
isIp.v6 = string => ipRegex.v6({exact: true}).test(string); | ||
module.exports = isIp; |
{ | ||
"name": "is-ip", | ||
"version": "2.0.0", | ||
"description": "Check if a string is an IP address", | ||
"license": "MIT", | ||
"repository": "sindresorhus/is-ip", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"ip", | ||
"ipv6", | ||
"ipv4", | ||
"regex", | ||
"regexp", | ||
"re", | ||
"match", | ||
"test", | ||
"find", | ||
"text", | ||
"pattern", | ||
"internet", | ||
"protocol", | ||
"address", | ||
"validate", | ||
"detect", | ||
"check", | ||
"is", | ||
"string" | ||
], | ||
"dependencies": { | ||
"ip-regex": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
"name": "is-ip", | ||
"version": "3.0.0", | ||
"description": "Check if a string is an IP address", | ||
"license": "MIT", | ||
"repository": "sindresorhus/is-ip", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"keywords": [ | ||
"ip", | ||
"ipv6", | ||
"ipv4", | ||
"regex", | ||
"regexp", | ||
"match", | ||
"test", | ||
"find", | ||
"text", | ||
"pattern", | ||
"internet", | ||
"protocol", | ||
"address", | ||
"validate", | ||
"detect", | ||
"check", | ||
"is", | ||
"string" | ||
], | ||
"dependencies": { | ||
"ip-regex": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -9,3 +9,3 @@ # is-ip [](https://travis-ci.org/sindresorhus/is-ip) | ||
``` | ||
$ npm install --save is-ip | ||
$ npm install is-ip | ||
``` | ||
@@ -32,13 +32,13 @@ | ||
### isIp(input) | ||
### isIp(string) | ||
Check if `input` is IPv4 or IPv6. | ||
Check if `string` is IPv4 or IPv6. | ||
### isIp.v4(input) | ||
### isIp.v4(string) | ||
Check if `input` is IPv4. | ||
Check if `string` is IPv4. | ||
### isIp.v6(input) | ||
### isIp.v6(string) | ||
Check if `input` is IPv6. | ||
Check if `string` is IPv6. | ||
@@ -49,2 +49,4 @@ | ||
- [ip-regex](https://github.com/sindresorhus/ip-regex) - Regular expression for matching IP addresses | ||
- [is-cidr](https://github.com/silverwind/is-cidr) - Check if a string is an IP address in CIDR notation | ||
- [cidr-regex](https://github.com/silverwind/cidr-regex) - Regular expression for matching IP addresses in CIDR notation | ||
@@ -51,0 +53,0 @@ |
Sorry, the diff of this file is not supported yet
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3598
26.33%5
25%41
720%54
3.85%0
-100%3
50%+ Added
- Removed
Updated