Interface StringifyOptions

Options for how IP addresses should be formatted 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: Return the IP address in its "sanitized" notation. For example:

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

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

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

'long': Return the IP address in its longest notation, with each bit chunk padded with 0. For example:

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