@common.js/ip-regex 5.0.0 → 5.0.1

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 (2) hide show
  1. package/package.json +11 -2
  2. package/readme.md +0 -77
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@common.js/ip-regex",
3
- "version": "5.0.0",
4
- "description": "Regular expression for matching IP addresses (IPv4 & IPv6)",
3
+ "version": "5.0.1",
4
+ "description": "ip-regex package exported as CommonJS modules",
5
5
  "license": "MIT",
6
6
  "repository": "etienne-martin/common.js",
7
7
  "funding": "https://github.com/sponsors/sindresorhus",
8
8
  "type": "commonjs",
9
+ "exports": "./index.js",
9
10
  "engines": {
10
11
  "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
11
12
  },
@@ -23,5 +24,13 @@
23
24
  },
24
25
  "homepage": "https://github.com/etienne-martin/common.js#readme",
25
26
  "dependencies": {},
27
+ "commonjs": {
28
+ "source": {
29
+ "name": "ip-regex",
30
+ "version": "5.0.0"
31
+ },
32
+ "transformRevision": 1,
33
+ "buildKey": "548fb4253bab425b288b45678388e3c50dd7bd5adbca8e8d2d43cb75902f3288"
34
+ },
26
35
  "main": "./index.js"
27
36
  }
package/readme.md DELETED
@@ -1,77 +0,0 @@
1
- # ip-regex
2
-
3
- > Regular expression for matching IP addresses
4
-
5
- ## Install
6
-
7
- ```sh
8
- $ npm install ip-regex
9
- ```
10
-
11
- This module targets Node.js 12 or later and the latest version of Chrome, Firefox, and Safari. If you want support for older browsers, use version 2.1.0: `npm install ip-regex@2.1.0`
12
-
13
- ## Usage
14
-
15
- ```js
16
- import ipRegex from 'ip-regex';
17
-
18
- // Contains an IP address?
19
- ipRegex().test('unicorn 192.168.0.1');
20
- //=> true
21
-
22
- // Is an IP address?
23
- ipRegex({exact: true}).test('unicorn 192.168.0.1');
24
- //=> false
25
-
26
- ipRegex.v6({exact: true}).test('1:2:3:4:5:6:7:8');
27
- //=> true
28
-
29
- 'unicorn 192.168.0.1 cake 1:2:3:4:5:6:7:8 rainbow'.match(ipRegex());
30
- //=> ['192.168.0.1', '1:2:3:4:5:6:7:8']
31
-
32
- // Contains an IP address?
33
- ipRegex({includeBoundaries: true}).test('192.168.0.2000000000');
34
- //=> false
35
-
36
- // Matches an IP address?
37
- '192.168.0.2000000000'.match(ipRegex({includeBoundaries: true}));
38
- //=> null
39
- ```
40
-
41
- ## API
42
-
43
- ### ipRegex(options?)
44
-
45
- Returns a regex for matching both IPv4 and IPv6.
46
-
47
- ### ipRegex.v4(options?)
48
-
49
- Returns a regex for matching IPv4.
50
-
51
- ### ipRegex.v6(options?)
52
-
53
- Returns a regex for matching IPv6.
54
-
55
- #### options
56
-
57
- Type: `object`
58
-
59
- ##### exact
60
-
61
- Type: `boolean`\
62
- Default: `false` *(Matches any IP address in a string)*
63
-
64
- Only match an exact string. Useful with `RegExp#test()` to check if a string is an IP address.
65
-
66
- ##### includeBoundaries
67
-
68
- Type: `boolean`\
69
- Default: `false`
70
-
71
- Include boundaries in the regex. When `true`, `192.168.0.2000000000` will report as an invalid IPv4 address. If this option is not set, the mentioned IPv4 address would report as valid (ignoring the trailing zeros).
72
-
73
- ## Related
74
-
75
- - [is-ip](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address
76
- - [is-cidr](https://github.com/silverwind/is-cidr) - Check if a string is an IP address in CIDR notation
77
- - [cidr-regex](https://github.com/silverwind/cidr-regex) - Regular expression for matching IP addresses in CIDR notation