Skip to main content

JS Kit SDK API Reference / Utilities / parseSupportedTld

Function: parseSupportedTld()

parseSupportedTld(domain, supportedTlds?): [string, string]

Defined in: utils/tld.ts:48

Ensures domain ends with one of the supportedTlds and strips that suffix.

Parameters​

domain​

string

Domain name to parse

supportedTlds?​

readonly string[] = SUPPORTED_TLDS

Supported suffixes to match against

Returns​

[string, string]

Domain name without suffix and the matching suffix.

Throws​

UnsupportedTldError If no supported suffix matches.

Example​

const [domain, tld] = parseSupportedTld("example.sns");