JavaScript SDK API Reference / Utilities / parseSupportedTld
Function: parseSupportedTld()
parseSupportedTld(
domain,supportedTlds?): [string,string]
Defined in: utils/tld.ts:50
Validates that domain ends with one of the supportedTlds, strips that
suffix, and returns a [trimmedDomain, tld] tuple.
Parameters
domain
string
Domain name including a supported suffix
supportedTlds?
readonly string[] = SUPPORTED_TLDS
Suffixes accepted by this parse operation
Returns
[string, string]
The TLD-trimmed domain and matching suffix
Throws
When the domain does not end with a supported suffix
Example
const [name, tld] = parseSupportedTld("example.sns");