Package Exports
- is-cidr
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-cidr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
is-cidr
Check if a string is a valid CIDR
Install
$ npm install --save is-cidr
Usage
import isCidr from 'is-cidr' // default is isCidrV4
import { isCidrV4, isCidrV6 } from 'is-cidr'
// OR
var isCidrV4 = require('is-cidr').isCidrV4
var isCidrV6 = require('is-cidr').isCidrV6
// is a CIDR v4
isCidr('18.101.25.153/24') // true
// is not a CIDR v4
isCidrV4('999.999.999.999/12') // false
// is a CIDR v6
isCidrV6('fe80:0000:0000:0000:0204:61ff:fe9d:f156') // true
// is not a CIDR v6
isCidrV6('fe80:0000:0000:0000:0204:61ff:fe9d:f156/a') // false
API
isCidr(string)
Check if a string is CIDR IPv4.
isCidrV4(string)
Check if a string is CIDR IPv4.
isCidrV6(string)
Check if a string is CIDR IPv6.
License
MIT © Felipe Apostol