Interface StringifyOptions

Options for formatting IP addresses in the output.

interface StringifyOptions {
    capitalize?: boolean;
    mode?: "short" | "long";
}

Properties

Properties

capitalize?: boolean

Whether to capitalize the output IP address.

mode?: "short" | "long"

undefined: Returns the IP address in its "sanitized" form. For example:

  • 192.168.0.1 (for IPv4 addresses, same as mode: 'short')
  • fd12:3456:789a:1:0:0:0:0

'short': Returns the IP address in its shortest notation. For example:

  • 192.168.0.1 (IPv4, same as mode: undefined)
  • fd12:3456:789a:1::

'long': Returns the IP address in its longest notation, with each segment padded with leading zeros. For example:

  • 192.168.000.001
  • fd12:3456:789a:0001:0000:0000:0000:0000