forked from lupomontero/psl
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
33 lines (29 loc) · 917 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
declare module "@imput/psl" {
export function parse(domain: string): ParsedDomain | ParseError;
export function get(domain: null | undefined): null;
export function get(domain: string): string | null;
export function isValid(domain: string): boolean;
export interface ParsedDomain {
tld: string | null;
sld: string | null;
domain: string | null;
subdomain: string | null;
listed: boolean;
input: string;
error: undefined;
}
export interface ParseError {
input: string;
error: {
code:
| "DOMAIN_TOO_SHORT"
| "DOMAIN_TOO_LONG"
| "LABEL_STARTS_WITH_DASH"
| "LABEL_ENDS_WITH_DASH"
| "LABEL_TOO_LONG"
| "LABEL_TOO_SHORT"
| "LABEL_INVALID_CHARS";
message: string;
};
}
}