cidr-regex 2.0.6 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/index.js +3 -3
  3. package/package.json +7 -6
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # cidr-regex
2
- > Regular expression for matching IP addresses in CIDR notation
3
-
4
2
  [![](https://img.shields.io/npm/v/cidr-regex.svg?style=flat)](https://www.npmjs.org/package/cidr-regex) [![](https://img.shields.io/npm/dm/cidr-regex.svg)](https://www.npmjs.org/package/cidr-regex) [![](https://api.travis-ci.org/silverwind/cidr-regex.svg?style=flat)](https://travis-ci.org/silverwind/cidr-regex)
5
3
 
4
+ > Regular expression for matching IP addresses in CIDR notation
5
+
6
6
  ## Install
7
7
 
8
8
  ```sh
@@ -26,7 +26,7 @@ cidrRegex.v6({exact: true}).test('1:2:3:4:5:6:7:8/64');
26
26
  //=> true
27
27
 
28
28
  'foo 192.168.0.1/24 bar 1:2:3:4:5:6:7:8/64 baz'.match(cidrRegex());
29
- //=> ['192.168.0.1', '1:2:3:4:5:6:7:8']
29
+ //=> ['192.168.0.1/24', '1:2:3:4:5:6:7:8/64']
30
30
  ```
31
31
 
32
32
  ## API
package/index.js CHANGED
@@ -5,9 +5,9 @@ const ipRegex = require("ip-regex");
5
5
  const v4 = ipRegex.v4().source + "\\/(3[0-2]|[12]?[0-9])";
6
6
  const v6 = ipRegex.v6().source + "\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])";
7
7
 
8
- const ip = module.exports = opts => opts && opts.exact ?
8
+ const cidr = module.exports = opts => opts && opts.exact ?
9
9
  new RegExp(`(?:^${v4}$)|(?:^${v6}$)`) :
10
10
  new RegExp(`(?:${v4})|(?:${v6})`, "g");
11
11
 
12
- ip.v4 = opts => opts && opts.exact ? new RegExp(`^${v4}$`) : new RegExp(v4, "g");
13
- ip.v6 = opts => opts && opts.exact ? new RegExp(`^${v6}$`) : new RegExp(v6, "g");
12
+ cidr.v4 = opts => opts && opts.exact ? new RegExp(`^${v4}$`) : new RegExp(v4, "g");
13
+ cidr.v6 = opts => opts && opts.exact ? new RegExp(`^${v6}$`) : new RegExp(v6, "g");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cidr-regex",
3
- "version": "2.0.6",
3
+ "version": "2.0.10",
4
4
  "description": "Regular expression for matching IP addresses in CIDR notation",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "contributors": [
@@ -27,12 +27,13 @@
27
27
  "ip",
28
28
  "ip address"
29
29
  ],
30
- "devDependencies": {
31
- "ava": "^0.24.0",
32
- "eslint": "^4.13.1",
33
- "updates": "^2.0.3"
34
- },
35
30
  "dependencies": {
36
31
  "ip-regex": "^2.1.0"
32
+ },
33
+ "devDependencies": {
34
+ "eslint": "^5.6.0",
35
+ "eslint-config-silverwind": "^2.0.9",
36
+ "updates": "^4.3.0",
37
+ "ver": "^2.0.1"
37
38
  }
38
39
  }