Skip to main content

JS Kit SDK API Reference / Utilities / getTld

Function: getTld()

getTld(domain, supportedTlds?): string | undefined

Defined in: utils/tld.ts:30

Returns the matching TLD from supportedTlds if domain ends with one, or undefined otherwise.

Parameters

domain

string

Domain name to inspect

supportedTlds?

readonly string[] = SUPPORTED_TLDS

Supported suffixes to match against

Returns

string | undefined

The matching suffix, or undefined when none match.

Example

const tld = getTld("example.sns");