node/deps/npm/node_modules/is-cidr
Myles Borins ace4fe566f
deps: update npm to 5.5.1
Closes: https://github.com/nodejs/node/pull/16280

PR-URL: https://github.com/nodejs/node/pull/16509
Fixes: https://github.com/nodejs/node/issues/14161
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-10-29 21:32:15 -04:00
..
example deps: update npm to 5.5.1 2017-10-29 21:32:15 -04:00
lib deps: update npm to 5.5.1 2017-10-29 21:32:15 -04:00
node_modules/cidr-regex deps: update npm to 5.5.1 2017-10-29 21:32:15 -04:00
test deps: update npm to 5.5.1 2017-10-29 21:32:15 -04:00
.npmignore deps: update npm to 5.5.1 2017-10-29 21:32:15 -04:00
.travis.yml deps: update npm to 5.5.1 2017-10-29 21:32:15 -04:00
package.json deps: update npm to 5.5.1 2017-10-29 21:32:15 -04:00
README.md deps: update npm to 5.5.1 2017-10-29 21:32:15 -04:00

is-cidr

Check if a string is a valid CIDR

semantic-release version MIT License travis build js-standard-style Commitizen friendly downloads

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