Skip to content

splitBitPrefix

splitBitPrefix(prefix, subnetPrefixLength): BitPrefix[]

Defined in: packages/net-address/src/prefix/aggregate.ts:51

Divides a prefix into every subnet of subnetPrefixLength.

Allocates 2 ** (subnetPrefixLength - prefix.prefixLength) entries, so the cost is exponential in the difference and the caller chooses it.

BitPrefix

number

BitPrefix[]

RangeError When subnetPrefixLength is not between the prefix’s own length and its bit width, or when the subnet count exceeds what an array can hold.