Optional
capitalizeWhether to convert output to uppercase (applies to IPv6 hex segments).
Optional
conditionOptional callback to filter IP addresses by version or CIDR status.
IP version (4
for IPv4, 6
for IPv6).
Whether the address includes a CIDR suffix.
true
to accept the address, false
to reject.
Optional
formatAddress formatting style:
'default'
(default):
192.168.0.1
)fd12:3456:789a:1:0:0:0:0
)'short'
: Aggressive shortening for IPv6 using ::
per RFC 5952.
'long'
: Full zero-padded form.
192.168.000.001
fd12:3456:789a:0001:0000:0000:0000:0000
Optional
modeUse format instead.
Optional
suppressWhether to suppress explicit full-length CIDRs (i.e., /32
for IPv4 and /128
for IPv6).
When true
, these CIDRs are treated as plain host addresses rather than as CIDR ranges.
(Default: true
)
For example, if the input string is "192.168.0.1/32"
and this option is true
, the
bit length is suppressed and the address is parsed as "192.168.0.1"
.
Combined options for parsing and formatting IP addresses.
This interface is an amalgamation of both ParseOptions and StringifyOptions, allowing configuration of both input parsing behavior and output formatting style.