Interface ParseOptions

Options for parsing IP string input.

interface ParseOptions {
    conditionPredicate?: ((version: 4 | 6, isCidr: boolean) => boolean);
    suppressFullLengthCidr?: boolean;
}

Hierarchy (view full)

Properties

conditionPredicate?: ((version: 4 | 6, isCidr: boolean) => boolean)

Optional callback to filter IP addresses by version or CIDR status.

Type declaration

    • (version, isCidr): boolean
    • Parameters

      • version: 4 | 6

        IP version (4 for IPv4, 6 for IPv6).

      • isCidr: boolean

        Whether the address includes a CIDR suffix.

      Returns boolean

      true to accept the address, false to reject.

suppressFullLengthCidr?: boolean

Whether 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".