is-cidr

WebJar for is-cidr

License

License

BSD 2-Clause
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

is-cidr
Last Version

Last Version

4.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

is-cidr
WebJar for is-cidr
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/silverwind/is-cidr

Download is-cidr

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/is-cidr/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>is-cidr</artifactId>
    <version>4.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/is-cidr/
implementation 'org.webjars.npm:is-cidr:4.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/is-cidr/
implementation ("org.webjars.npm:is-cidr:4.0.2")
'org.webjars.npm:is-cidr:jar:4.0.2'
<dependency org="org.webjars.npm" name="is-cidr" rev="4.0.2">
  <artifact name="is-cidr" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='is-cidr', version='4.0.2')
)
libraryDependencies += "org.webjars.npm" % "is-cidr" % "4.0.2"
[org.webjars.npm/is-cidr "4.0.2"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : cidr-regex jar [3.1.1,4)

Project Modules

There are no modules declared in this project.

is-cidr

Check if a string is an IP address in CIDR notation

Install

npm i is-cidr

Usage

const 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
isCidr.v6("10.0.0.0/24"); //=> false

API

isCidr(input)

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.

isCidr.v4(input)

Check if input is a IPv4 CIDR address. Returns a boolean.

isCidr.v6(input)

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

Related

  • cidr-regex - Regular expression for matching IP addresses in CIDR notation
  • is-ip - Check if a string is an IP address
  • ip-regex - Regular expression for matching IP addresses

License

© silverwind, distributed under BSD licence

Based on previous work by Felipe Apostol

Versions

Version
4.0.2
3.1.1
3.1.0
3.0.0
2.0.7
2.0.6
2.0.5
1.0.0