cidr-regex 4.1.2 → 5.0.0
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/README.md +6 -7
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/package.json +12 -13
package/README.md
CHANGED
|
@@ -29,24 +29,23 @@ cidrRegex.v6({exact: true}).test("1:2:3:4:5:6:7:8/64");
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
## API
|
|
32
|
-
### cidrRegex(
|
|
32
|
+
### cidrRegex(options?: CidrRegexOptions)
|
|
33
33
|
|
|
34
34
|
Returns a regex for matching both IPv4 and IPv6 CIDR IP addresses.
|
|
35
35
|
|
|
36
|
-
### cidrRegex.v4(
|
|
36
|
+
### cidrRegex.v4(options?: CidrRegexOptions)
|
|
37
37
|
|
|
38
38
|
Returns a regex for matching IPv4 CIDR IP addresses.
|
|
39
39
|
|
|
40
|
-
### cidrRegex.v6(
|
|
40
|
+
### cidrRegex.v6(options?: CidrRegexOptions)
|
|
41
41
|
|
|
42
42
|
Returns a regex for matching IPv6 CIDR IP addresses.
|
|
43
43
|
|
|
44
|
-
####
|
|
44
|
+
#### CidrRegexOptions
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
Default: `false` *(Matches any CIDR IP address in a string)*
|
|
46
|
+
The options object has the following properties:
|
|
48
47
|
|
|
49
|
-
Only match an exact string. Useful with `RegExp#test()` to check if a string is a CIDR IP address.
|
|
48
|
+
- `exact` *boolean*: Only match an exact string. Useful with `RegExp#test()` to check if a string is a CIDR IP address. Default: false.
|
|
50
49
|
|
|
51
50
|
## Related
|
|
52
51
|
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type CidrRegexOptions = {
|
|
2
|
+
/**
|
|
3
|
+
Only match an exact string. Useful with `RegExp#test()` to check if a string is an IP address. *(`false` matches any IP address in a string)*
|
|
4
|
+
|
|
5
|
+
@defaultValue false
|
|
6
|
+
*/
|
|
7
|
+
readonly exact?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const cidrRegex: {
|
|
10
|
+
({ exact }?: CidrRegexOptions): RegExp;
|
|
11
|
+
v4({ exact }?: CidrRegexOptions): RegExp;
|
|
12
|
+
v6({ exact }?: CidrRegexOptions): RegExp;
|
|
13
|
+
};
|
|
14
|
+
export declare const v4: ({ exact }?: CidrRegexOptions) => RegExp;
|
|
15
|
+
export declare const v6: ({ exact }?: CidrRegexOptions) => RegExp;
|
|
16
|
+
export default cidrRegex;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GAAG;IACtB;;;;MAIE;IACF,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAA;AAWD,QAAA,MAAM,SAAS;iBAAa,gBAAgB;mBACD,gBAAgB;mBAChB,gBAAgB;CAFmE,CAAC;AAC/H,eAAO,MAAM,EAAE,eAA4B,gBAAgB,WAA2D,CAAC;AACvH,eAAO,MAAM,EAAE,eAA4B,gBAAgB,WAA2D,CAAC;AACvH,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cidr-regex",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Regular expression for matching IP addresses in CIDR notation",
|
|
5
5
|
"author": "silverwind <me@silverwind.io>",
|
|
6
6
|
"contributors": [
|
|
@@ -17,23 +17,22 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
20
|
+
"node": ">=20"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"ip-regex": "^5.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/node": "
|
|
26
|
+
"@types/node": "24.1.0",
|
|
27
27
|
"eslint": "8.57.0",
|
|
28
|
-
"eslint-config-silverwind": "
|
|
29
|
-
"
|
|
30
|
-
"typescript": "
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"vite": "5.4.
|
|
35
|
-
"
|
|
36
|
-
"vitest": "2.0
|
|
37
|
-
"vitest-config-silverwind": "9.1.0"
|
|
28
|
+
"eslint-config-silverwind": "101.4.1",
|
|
29
|
+
"typescript": "5.8.3",
|
|
30
|
+
"typescript-config-silverwind": "9.0.8",
|
|
31
|
+
"updates": "16.5.2",
|
|
32
|
+
"versions": "13.1.1",
|
|
33
|
+
"vite": "7.0.6",
|
|
34
|
+
"vite-config-silverwind": "5.4.0",
|
|
35
|
+
"vitest": "3.2.4",
|
|
36
|
+
"vitest-config-silverwind": "10.2.0"
|
|
38
37
|
}
|
|
39
38
|
}
|