is-cidr
Advanced tools
Comparing version 5.0.3 to 5.0.4
@@ -1,31 +0,20 @@ | ||
declare const isCidr: { | ||
/** | ||
Check if `string` is a IPv4 or IPv6 CIDR address. | ||
@returns Either `4`, `6` (indicating the IP version) or `0` if the string is not a CIDR. | ||
@example | ||
``` | ||
import isCidr = require('is-cidr'); | ||
isCidr('192.168.0.1/24'); //=> 4 | ||
isCidr('1:2:3:4:5:6:7:8/64'); //=> 6 | ||
isCidr('10.0.0.0'); //=> 0 | ||
``` | ||
*/ | ||
(string: string): 6 | 4 | 0; | ||
/** | ||
Test if `input` is a IPv4 CIDR. | ||
/** | ||
Check if `string` is a IPv4 CIDR address. | ||
*/ | ||
v4(string: string): boolean; | ||
@returns A boolean. | ||
*/ | ||
export function v4(str: string): boolean; | ||
/** | ||
Check if `string` is a IPv6 CIDR address. | ||
@example | ||
``` | ||
import isCidr = require('is-cidr'); | ||
isCidr.v6('10.0.0.0/24'); //=> false | ||
``` | ||
*/ | ||
v6(string: string): boolean; | ||
}; | ||
/** | ||
Test if `input` is a IPv6 CIDR. | ||
export = isCidr; | ||
@returns A boolean. | ||
*/ | ||
export function v6(str: string): boolean; | ||
/** | ||
Test if `input` is a IPv4 or IPv6 CIDR. | ||
@returns Either `4`, `6` (indicating the IP version) or `0` if the string is not a CIDR. | ||
*/ | ||
export default function isCidr(str: string): 6 | 4 | 0; |
{ | ||
"name": "is-cidr", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"description": "Check if a string is an IP address in CIDR notation", | ||
@@ -22,12 +22,13 @@ "author": "silverwind <me@silverwind.io>", | ||
"dependencies": { | ||
"cidr-regex": "4.0.3" | ||
"cidr-regex": "^4.0.4" | ||
}, | ||
"devDependencies": { | ||
"eslint": "8.37.0", | ||
"eslint-config-silverwind": "65.1.3", | ||
"tsd": "0.28.1", | ||
"updates": "13.2.9", | ||
"versions": "10.4.2", | ||
"vitest": "0.29.8" | ||
"eslint": "8.57.0", | ||
"eslint-config-silverwind": "83.0.1", | ||
"tsd": "0.31.0", | ||
"updates": "16.0.0", | ||
"versions": "12.0.1", | ||
"vitest": "1.4.0", | ||
"vitest-config-silverwind": "7.0.3" | ||
} | ||
} |
# is-cidr | ||
[![](https://img.shields.io/npm/v/is-cidr.svg?style=flat)](https://www.npmjs.org/package/is-cidr) [![](https://img.shields.io/npm/dm/is-cidr.svg)](https://www.npmjs.org/package/is-cidr) [![](https://packagephobia.com/badge?p=is-cidr)](https://packagephobia.com/result?p=is-cidr) | ||
[![](https://img.shields.io/npm/v/is-cidr.svg?style=flat)](https://www.npmjs.org/package/is-cidr) [![](https://img.shields.io/npm/dm/is-cidr.svg)](https://www.npmjs.org/package/is-cidr) | ||
> Check if a string is an IP address in CIDR notation | ||
@@ -27,17 +26,18 @@ | ||
Check if `input` is a IPv4 or IPv6 CIDR address. Returns either `4`, `6` (indicating the IP version) or `0` if the string is not a CIDR. | ||
Check if `input` is a IPv4 or IPv6 CIDR. Returns either `4`, `6` (indicating the IP version) or `0` if the string is not a CIDR. | ||
### isCidr.v4(input) | ||
Check if `input` is a IPv4 CIDR address. Returns a boolean. | ||
Check if `input` is a IPv4 CIDR. Returns a boolean. | ||
### isCidr.v6(input) | ||
Check if `input` is a IPv6 CIDR address. Returns a boolean. | ||
Check if `input` is a IPv6 CIDR. Returns a boolean. | ||
## Related | ||
- [cidr-regex](https://github.com/silverwind/cidr-regex) - Regular expression for matching IP addresses in CIDR notation | ||
- [ip-bigint](https://github.com/silverwind/ip-bigint) - Convert IPv4 and IPv6 addresses to native BigInt and vice-versa | ||
- [ip-regex](https://github.com/sindresorhus/ip-regex) - Regular expression for matching IP addresses | ||
- [is-ip](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address | ||
- [ip-regex](https://github.com/sindresorhus/ip-regex) - Regular expression for matching IP addresses | ||
- [cidr-regex](https://github.com/silverwind/cidr-regex) - Check if a string is an IP address in CIDR notation | ||
- [cidr-tools](https://github.com/silverwind/cidr-tools) - Tools to work with IPv4 and IPv6 CIDR network lists | ||
@@ -44,0 +44,0 @@ |
3049
7
4
22
+ Addedcidr-regex@4.0.5(transitive)
- Removedcidr-regex@4.0.3(transitive)
Updatedcidr-regex@^4.0.4