cidr-block - v2.1.1
    Preparing search index...

    Function isValidCIDR

    • Validates whether the given input is a valid IPv6 CIDR.

      Parameters

      • cidr: Ipv6CidrLiteral

        The IPv6 CIDR to validate, which can be in string, object, or tuple format.

      Returns boolean

      True if the input is a valid IPv6 CIDR; otherwise, false.

      import { ipv6 } from 'cidr-block';

      ipv6.isValidCIDR("2001:db8::/32"); // true
      ipv6.isValidCIDR("2001:db8::/129"); // false (range out of bounds)
      ipv6.isValidCIDR({ address: "2001:db8::", range: 32 }); // true
      ipv6.isValidCIDR(["2001:db8::", 32]); // true
      ipv6.isValidCIDR("invalid/32"); // false