Validates whether the given input is a valid IPv4 CIDR.
The IPv4 CIDR to validate, which can be in string, object, or tuple format.
True if the input is a valid IPv4 CIDR; otherwise, false.
import { ipv4 } from 'cidr-block';ipv4.isValidCIDR("192.168.0.0/24"); // trueipv4.isValidCIDR("192.168.0.0/33"); // false (range out of bounds)ipv4.isValidCIDR({ address: "10.0.0.0", range: 8 }); // trueipv4.isValidCIDR([[172, 16, 0, 0], 12]); // trueipv4.isValidCIDR("invalid/24"); // false Copy
import { ipv4 } from 'cidr-block';ipv4.isValidCIDR("192.168.0.0/24"); // trueipv4.isValidCIDR("192.168.0.0/33"); // false (range out of bounds)ipv4.isValidCIDR({ address: "10.0.0.0", range: 8 }); // trueipv4.isValidCIDR([[172, 16, 0, 0], 12]); // trueipv4.isValidCIDR("invalid/24"); // false
Validates whether the given input is a valid IPv4 CIDR.