function isCidrv6
isCidrv6(cidr: Cidr): cidr is Cidrv6

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

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

Examples

Example 1

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

assert(isCidrv6(parseCidr("2001:db8::/32")));
assert(isCidrv6({ address: 0x20010db8n << 96n, mask: 0xFFFFFFFF000000000000000000000000n }));

Parameters

cidr: Cidr

The CIDR block to check

Return Type

cidr is Cidrv6

true if the CIDR is a Cidrv6

Usage

import { isCidrv6 } from "cidr.ts";