Skip to main content

url-to-domain

ai-research-agent / extractor/html-to-cite/url-to-domain

Functions

convertURLToDomain()

function convertURLToDomain(domain): string

Extract TLD and hostname from domain in Regex. There's two or more part TLDs so it is hard to tell if host.secondTLD.tld or host.tld is correct way to get root domain (e.g. abc.go.jp, abc.co.uk)

Parameters

ParameterTypeDescription

domain

string

Returns

string

rootDomain