1 | export as namespace psl;
|
2 |
|
3 | export function parse(domain: string): ParsedDomain | ParseError;
|
4 |
|
5 | export function get(domain: null | undefined): null;
|
6 | export function get(domain: string): string | null;
|
7 |
|
8 | export function isValid(domain: string): boolean;
|
9 |
|
10 | export 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 |
|
20 | export 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 | }
|