Skip to content

Commit 1690ce2

Browse files
committed
Simplify tldts call
1 parent 01c7d8c commit 1690ce2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/curated-corpus/helpers/domainHelpers.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { parse } from 'tldts';
1+
import { getDomain } from 'tldts';
22

33
export interface DomainInfo {
44
/**
@@ -38,10 +38,8 @@ export function extractDomainInfo(url: string): DomainInfo {
3838
const urlObj = new URL(url);
3939
const hostname = urlObj.hostname;
4040

41-
// Use tldts to parse domain components
42-
const parsed = parse(hostname);
43-
44-
const registrableDomain = parsed.domain ?? null;
41+
// Use tldts to get registrable domain
42+
const registrableDomain = getDomain(hostname);
4543

4644
let subdomainHostname: string | null = null;
4745
const hostnameWithoutWww = hostname.startsWith('www.')

0 commit comments

Comments
 (0)