UNPKG

803 BTypeScriptView Raw
1export as namespace psl;
2
3export function parse(domain: string): ParsedDomain | ParseError;
4
5export function get(domain: null | undefined): null;
6export function get(domain: string): string | null;
7
8export function isValid(domain: string): boolean;
9
10export interface ParsedDomain {
11 tld: string | null;
12 sld: string | null;
13 domain: string | null;
14 subdomain: string | null;
15 listed: boolean;
16 input: string;
17 error: undefined;
18}
19
20export interface ParseError {
21 input: string;
22 error: {
23 code:
24 | "DOMAIN_TOO_SHORT"
25 | "DOMAIN_TOO_LONG"
26 | "LABEL_STARTS_WITH_DASH"
27 | "LABEL_ENDS_WITH_DASH"
28 | "LABEL_TOO_LONG"
29 | "LABEL_TOO_SHORT"
30 | "LABEL_INVALID_CHARS";
31 message: string;
32 };
33}