cidr-regex
Advanced tools
Comparing version 4.0.4 to 4.0.5
@@ -20,25 +20,31 @@ export type Options = { | ||
/** | ||
Regular expression for matching IP addresses in CIDR notation | ||
declare const _default: { | ||
@returns A regex for matching both IPv4 and IPv6 CIDRs. | ||
/** | ||
Regular expression for matching IP addresses in CIDR notation | ||
@example | ||
``` | ||
// Contains a CIDR IP address? | ||
cidrRegex().test("foo 192.168.0.1/24"); | ||
//=> true | ||
@returns A regex for matching both IPv4 and IPv6 CIDRs. | ||
// Is a CIDR IP address? | ||
cidrRegex({exact: true}).test("foo 192.168.0.1/24"); | ||
//=> false | ||
@example | ||
``` | ||
// Contains a CIDR IP address? | ||
cidrRegex().test("foo 192.168.0.1/24"); | ||
//=> true | ||
cidrRegex.v6({exact: true}).test("1:2:3:4:5:6:7:8/64"); | ||
//=> true | ||
// Is a CIDR IP address? | ||
cidrRegex({exact: true}).test("foo 192.168.0.1/24"); | ||
//=> false | ||
// Extract CIDRs from string | ||
"foo 192.168.0.1/24 bar 1:2:3:4:5:6:7:8/64 baz".match(cidrRegex()); | ||
//=> ["192.168.0.1/24", "1:2:3:4:5:6:7:8/64"] | ||
``` | ||
*/ | ||
export default function cidrRegex(options?: Options): RegExp; | ||
cidrRegex.v6({exact: true}).test("1:2:3:4:5:6:7:8/64"); | ||
//=> true | ||
// Extract CIDRs from string | ||
"foo 192.168.0.1/24 bar 1:2:3:4:5:6:7:8/64 baz".match(cidrRegex()); | ||
//=> ["192.168.0.1/24", "1:2:3:4:5:6:7:8/64"] | ||
``` | ||
*/ | ||
(options?: Options): RegExp, | ||
v4: typeof v4; | ||
v6: typeof v6; | ||
}; | ||
export default _default; |
{ | ||
"name": "cidr-regex", | ||
"version": "4.0.4", | ||
"version": "4.0.5", | ||
"description": "Regular expression for matching IP addresses in CIDR notation", | ||
@@ -5,0 +5,0 @@ "author": "silverwind <me@silverwind.io>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5958
51