TLD utilities for parsing and validating domain names.
getDomain(hostname: string): string | null
Gets the registrable domain (domain + public suffix).
getPublicSuffix(domain: string): string | null
Gets the public suffix of a domain. Returns the TLD or multi-part suffix (e.g., 'co.uk').
isIP(str: string): boolean
Checks if a string is an IP address (IPv4 or IPv6).
isIPv4(str: string): boolean
Checks if a string is a valid IPv4 address.
isIPv6(str: string): boolean
Checks if a string is a valid IPv6 address.
isValidHostname(hostname: string): boolean
Validates a hostname.
isValidLabel(label: string): boolean
Validates a hostname label (single part between dots).
parse(hostname: string): ParsedHost
Parses a hostname and returns detailed information. This is the main replacement for tldts.parse().