UNPKG

1.38 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/psl`
3
4# Summary
5This package contains type definitions for psl (https://github.com/wrangr/psl#readme).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/psl.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/psl/index.d.ts)
10````ts
11export as namespace psl;
12
13export function parse(domain: string): ParsedDomain | ParseError;
14
15export function get(domain: null | undefined): null;
16export function get(domain: string): string | null;
17
18export function isValid(domain: string): boolean;
19
20export interface ParsedDomain {
21 tld: string | null;
22 sld: string | null;
23 domain: string | null;
24 subdomain: string | null;
25 listed: boolean;
26 input: string;
27 error: undefined;
28}
29
30export interface ParseError {
31 input: string;
32 error: {
33 code:
34 | "DOMAIN_TOO_SHORT"
35 | "DOMAIN_TOO_LONG"
36 | "LABEL_STARTS_WITH_DASH"
37 | "LABEL_ENDS_WITH_DASH"
38 | "LABEL_TOO_LONG"
39 | "LABEL_TOO_SHORT"
40 | "LABEL_INVALID_CHARS";
41 message: string;
42 };
43}
44
45````
46
47### Additional Details
48 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
49 * Dependencies: none
50
51# Credits
52These definitions were written by [BendingBender](https://github.com/BendingBender).
53
\No newline at end of file