You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

cidr-regex

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cidr-regex - npm Package Compare versions

Comparing version

to
4.0.5

44

index.d.ts

@@ -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>",