How to use the is-cidr.isCidrV6 function in is-cidr

To help you get started, we’ve selected a few is-cidr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github npm / npm-profile / cmds / util / validate-cidr.js View on Github external
function validate (cidr) {
  if (isCidrV6(cidr)) {
    throw new Error('CIDR whitelist can only contain IPv4 addresses, ' + cidr + ' is IPv6')
  }
  if (!isCidrV4(cidr)) {
    throw new Error('CIDR whitelist contains invalid CIDR entry: ' + cidr)
  }
}

is-cidr

Check if a string is an IP address in CIDR notation

BSD-2-Clause
Latest version published 7 months ago

Package Health Score

67 / 100
Full package analysis

Similar packages