function isCidrv4
isCidrv4(cidr: Cidr): cidr is Cidrv4

Type guard that checks whether a Cidr is an IPv4 CIDR block.

Reads the version off the address, so both dialects pass.

Examples

Example 1

import { assert } from "@std/assert";
import { isCidrv4, parseCidr } from "@hertzg/ip/cidr";

assert(isCidrv4(parseCidr("10.0.0.0/8")));
assert(isCidrv4({ address: 167772160, mask: 0xFF000000 }));

Parameters

cidr: Cidr

The CIDR block to check

Return Type

cidr is Cidrv4

true if the CIDR is a Cidrv4

Usage

import { isCidrv4 } from "mod.ts";