cidr-regex 4.0.4 → 4.0.5
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.
- package/index.d.ts +25 -19
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -17,27 +17,33 @@ export function v4(options?: Options): RegExp;
|
|
|
17
17
|
*/
|
|
18
18
|
export function v6(options?: Options): RegExp;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
Regular expression for matching IP addresses in CIDR notation
|
|
20
|
+
declare const _default: {
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
Regular expression for matching IP addresses in CIDR notation
|
|
24
24
|
|
|
25
|
-
@
|
|
26
|
-
```
|
|
27
|
-
// Contains a CIDR IP address?
|
|
28
|
-
cidrRegex().test("foo 192.168.0.1/24");
|
|
29
|
-
//=> true
|
|
25
|
+
@returns A regex for matching both IPv4 and IPv6 CIDRs.
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
@example
|
|
28
|
+
```
|
|
29
|
+
// Contains a CIDR IP address?
|
|
30
|
+
cidrRegex().test("foo 192.168.0.1/24");
|
|
31
|
+
//=> true
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
// Is a CIDR IP address?
|
|
34
|
+
cidrRegex({exact: true}).test("foo 192.168.0.1/24");
|
|
35
|
+
//=> false
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
cidrRegex.v6({exact: true}).test("1:2:3:4:5:6:7:8/64");
|
|
38
|
+
//=> true
|
|
39
|
+
|
|
40
|
+
// Extract CIDRs from string
|
|
41
|
+
"foo 192.168.0.1/24 bar 1:2:3:4:5:6:7:8/64 baz".match(cidrRegex());
|
|
42
|
+
//=> ["192.168.0.1/24", "1:2:3:4:5:6:7:8/64"]
|
|
43
|
+
```
|
|
44
|
+
*/
|
|
45
|
+
(options?: Options): RegExp,
|
|
46
|
+
v4: typeof v4;
|
|
47
|
+
v6: typeof v6;
|
|
48
|
+
};
|
|
49
|
+
export default _default;
|