is-cidr
Check if a string is an IP address in CIDR notation
Last updated 2 months ago by GitHub Actions .
BSD-2-Clause · Repository · Original npm · Tarball · package.json
$ npm install is-cidr 
SYNC missed versions from official npm registry.

is-cidr

Check if a string is an IP address in CIDR notation

Usage

pnpm add is-cidr
import isCidr from "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
isCidr.v6("10.0.0.0/24"); //=> false

API

isCidr(input)

Check if input is an 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 an IPv4 CIDR. Returns a boolean.

isCidr.v6(input)

Check if input is an IPv6 CIDR. Returns a boolean.

Related

  • ip-bigint - Convert IPv4 and IPv6 addresses to native BigInt and vice-versa
  • ip-regex - Regular expression for matching IP addresses
  • is-ip - Check if a string is an IP address
  • cidr-regex - Regular expression for matching IP addresses in CIDR notation and bare IP addresses
  • cidr-tools - Tools to work with IPv4 and IPv6 CIDR network lists

© silverwind, distributed under BSD licence

Based on previous work by Felipe Apostol

Current Tags

  • 7.0.3                                ...           latest (2 months ago)

33 Versions

  • 7.0.3                                ...           2 months ago
  • 7.0.2                                ...           2 months ago
  • 7.0.1                                ...           4 months ago
  • 7.0.0                                ...           7 months ago
  • 6.0.4                                ...           7 months ago
  • 6.0.3                                ...           10 months ago
  • 6.0.2                                ...           10 months ago
  • 6.0.1                                ...           a year ago
  • 6.0.0                                ...           a year ago
  • 5.1.1                                ...           2 years ago
  • 5.1.0                                ...           3 years ago
  • 5.0.5                                ...           3 years ago
  • 5.0.4                                ...           3 years ago
  • 5.0.3                                ...           4 years ago
  • 5.0.2                                ...           4 years ago
  • 5.0.1                                ...           4 years ago
  • 5.0.0                                ...           4 years ago
  • 4.0.2                                ...           6 years ago
  • 4.0.1                                ...           6 years ago
  • 4.0.0                                ...           7 years ago
  • 3.1.1                                ...           7 years ago
  • 3.1.0                                ...           7 years ago
  • 3.0.0                                ...           8 years ago
  • 2.0.7                                ...           8 years ago
  • 2.0.6                                ...           8 years ago
  • 2.0.5                                ...           9 years ago
  • 2.0.4                                ...           9 years ago
  • 2.0.3                                ...           9 years ago
  • 2.0.2                                ...           9 years ago
  • 2.0.1                                ...           9 years ago
  • 2.0.0                                ...           9 years ago
  • 1.0.0                                ...           11 years ago
  • 0.0.0-semantically-released                                ...           11 years ago
Maintainers (1)
Downloads
Total 142
Today 0
This Week 9
This Month 68
Last Day 2
Last Week 4
Last Month 64
Dependencies (1)
Dev Dependencies (13)
Dependents (3)

© 2010 - cnpmjs.org x YWFE | Home | YWFE