How to use the is-cidr.v4 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 graalvm / graaljs / deps / npm / lib / token.js View on Github external
function validateCIDR (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 6 months ago

Package Health Score

64 / 100
Full package analysis

Similar packages