JavaScript SDK API Reference / Utilities / getTld
Function: getTld()
getTld(
domain,supportedTlds?):string|undefined
Defined in: utils/tld.ts:31
Returns the matching TLD from supportedTlds if domain ends with one,
or undefined otherwise.
Parameters
domain
string
Domain name including an optional suffix
supportedTlds?
readonly string[] = SUPPORTED_TLDS
Suffixes to match, defaulting to SDK-supported TLDs
Returns
string | undefined
The matching suffix, or undefined
Example
const tld = getTld("example.sns");