Networks.toArray() method

Every stored network as CIDR records, IPv4 first.

Signature:

toArray(canonical?: boolean): string[];

Parameters

Parameter

Type

Description

canonical

boolean

(Optional) for IPv6, render the expanded form rather than the compressed one

Returns:

string[]

One flat array covering both families, IPv4 records followed by IPv6.

Default Value

canonical defaults to false

Remarks

The result is a valid constructor argument, which makes this the readable way to round-trip a set. Not necessarily the records you built it from, though: each range is re-expressed as its minimal cover, so duplicates are gone and a range spanning several prefixes returns as several records. Addresses covered are identical either way.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.