Skip to content

toInetAddress

toInetAddress(family, address): InetAddress

Defined in: packages/node/src/net/inet-address.ts:22

Normalizes a family and address into an InetAddress. Validates and converts the family to ensure it is 4, 6, or null.

string | number | null

The IP family, either as a string (‘IPv4’, ‘IPv6’), number (4, 6), or null for unknown.

string

The IP address string.

InetAddress

An InetAddress object.

If the family is not valid (not ‘IPv4’/‘IPv6’ or 4/6 or null).