aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/is-cidr
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/is-cidr')
-rw-r--r--deps/npm/node_modules/is-cidr/README.md20
-rw-r--r--deps/npm/node_modules/is-cidr/index.js13
-rw-r--r--deps/npm/node_modules/is-cidr/package.json37
3 files changed, 37 insertions, 33 deletions
diff --git a/deps/npm/node_modules/is-cidr/README.md b/deps/npm/node_modules/is-cidr/README.md
index cd7c8c9686..1fa3ee9ede 100644
--- a/deps/npm/node_modules/is-cidr/README.md
+++ b/deps/npm/node_modules/is-cidr/README.md
@@ -7,7 +7,7 @@
## Install
```
-$ npm install --save is-cidr
+npm i is-cidr
```
@@ -16,14 +16,10 @@ $ npm install --save is-cidr
```js
const isCidr = require('is-cidr');
-isCidr('192.168.0.1/24');
-//=> true
-
-isCidr('1:2:3:4:5:6:7:8/64');
-//=> true
-
-isCidr.v4('1:2:3:4:5:6:7:8/64');
-//=> false
+isCidr('192.168.0.1/24'); //=> 4
+isCidr('1:2:3:4:5:6:7:8/64'); //=> 6
+isCidr('10.0.0.0'); //=> 0
+isCidr.v6('10.0.0.0/24'); //=> false
```
@@ -31,15 +27,15 @@ isCidr.v4('1:2:3:4:5:6:7:8/64');
### isCidr(input)
-Check if `input` is a IPv4 or IPv6 CIDR address.
+Check if `input` is a IPv4 or IPv6 CIDR address. Returns either `4`, `6` (indicating the IP version) or `0` if the string is not a CIDR.
### isCidr.v4(input)
-Check if `input` is a IPv4 CIDR address.
+Check if `input` is a IPv4 CIDR address. Returns a boolean.
### isCidr.v6(input)
-Check if `input` is a IPv6 CIDR address.
+Check if `input` is a IPv6 CIDR address. Returns a boolean.
## Related
diff --git a/deps/npm/node_modules/is-cidr/index.js b/deps/npm/node_modules/is-cidr/index.js
index b5a5026439..3eaf906c35 100644
--- a/deps/npm/node_modules/is-cidr/index.js
+++ b/deps/npm/node_modules/is-cidr/index.js
@@ -1,6 +1,13 @@
"use strict";
const cidrRegex = require("cidr-regex");
+const re4 = cidrRegex.v4({exact: true});
+const re6 = cidrRegex.v6({exact: true});
-const isCidr = module.exports = string => cidrRegex({exact: true}).test(string);
-isCidr.v4 = string => cidrRegex.v4({exact: true}).test(string);
-isCidr.v6 = string => cidrRegex.v6({exact: true}).test(string);
+const isCidr = module.exports = str => {
+ if (re4.test(str)) return 4;
+ if (re6.test(str)) return 6;
+ return 0;
+};
+
+isCidr.v4 = str => re4.test(str);
+isCidr.v6 = str => re6.test(str);
diff --git a/deps/npm/node_modules/is-cidr/package.json b/deps/npm/node_modules/is-cidr/package.json
index 6f735158ab..5737794e8c 100644
--- a/deps/npm/node_modules/is-cidr/package.json
+++ b/deps/npm/node_modules/is-cidr/package.json
@@ -1,28 +1,28 @@
{
- "_from": "is-cidr@2.0.6",
- "_id": "is-cidr@2.0.6",
+ "_from": "is-cidr@3.0.0",
+ "_id": "is-cidr@3.0.0",
"_inBundle": false,
- "_integrity": "sha512-A578p1dV22TgPXn6NCaDAPj6vJvYsBgAzUrAd28a4oldeXJjWqEUuSZOLIW3im51mazOKsoyVp8NU/OItlWacw==",
+ "_integrity": "sha512-8Xnnbjsb0x462VoYiGlhEi+drY8SFwrHiSYuzc/CEwco55vkehTaxAyIjEdpi3EMvLPPJAJi9FlzP+h+03gp0Q==",
"_location": "/is-cidr",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
- "raw": "is-cidr@2.0.6",
+ "raw": "is-cidr@3.0.0",
"name": "is-cidr",
"escapedName": "is-cidr",
- "rawSpec": "2.0.6",
+ "rawSpec": "3.0.0",
"saveSpec": null,
- "fetchSpec": "2.0.6"
+ "fetchSpec": "3.0.0"
},
"_requiredBy": [
"#USER",
"/"
],
- "_resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-2.0.6.tgz",
- "_shasum": "4b01c9693d8e18399dacd18a4f3d60ea5871ac60",
- "_spec": "is-cidr@2.0.6",
- "_where": "/Users/rebecca/code/npm",
+ "_resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-3.0.0.tgz",
+ "_shasum": "1acf35c9e881063cd5f696d48959b30fed3eed56",
+ "_spec": "is-cidr@3.0.0",
+ "_where": "/Users/aeschright/code/cli",
"author": {
"name": "silverwind",
"email": "me@silverwind.io"
@@ -39,18 +39,18 @@
}
],
"dependencies": {
- "cidr-regex": "^2.0.8"
+ "cidr-regex": "^2.0.10"
},
"deprecated": false,
"description": "Check if a string is an IP address in CIDR notation",
"devDependencies": {
- "ava": "^0.25.0",
- "eslint": "^4.19.1",
- "eslint-config-silverwind": "^1.0.42",
- "updates": "^3.0.0"
+ "eslint": "^5.7.0",
+ "eslint-config-silverwind": "^2.0.9",
+ "updates": "^4.5.2",
+ "ver": "^3.0.0"
},
"engines": {
- "node": ">=4"
+ "node": ">=6"
},
"files": [
"index.js"
@@ -64,7 +64,8 @@
"prefix",
"prefixes",
"ip",
- "ip address"
+ "ip address",
+ "network"
],
"license": "BSD-2-Clause",
"name": "is-cidr",
@@ -75,5 +76,5 @@
"scripts": {
"test": "make test"
},
- "version": "2.0.6"
+ "version": "3.0.0"
}