1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | declare namespace URLParse {
|
11 | type URLPart = 'auth'
|
12 | | 'hash'
|
13 | | 'host'
|
14 | | 'hostname'
|
15 | | 'href'
|
16 | | 'origin'
|
17 | | 'password'
|
18 | | 'pathname'
|
19 | | 'port'
|
20 | | 'protocol'
|
21 | | 'query'
|
22 | | 'slashes'
|
23 | | 'username';
|
24 |
|
25 | type QueryParser = (query: string) => object;
|
26 | }
|
27 |
|
28 | interface URLParse {
|
29 | readonly auth: string;
|
30 | readonly hash: string;
|
31 | readonly host: string;
|
32 | readonly hostname: string;
|
33 | readonly href: string;
|
34 | readonly origin: string;
|
35 | readonly password: string;
|
36 | readonly pathname: string;
|
37 | readonly port: string;
|
38 | readonly protocol: string;
|
39 | readonly query: { [key: string]: string | undefined };
|
40 | readonly slashes: boolean;
|
41 | readonly username: string;
|
42 | set(part: URLParse.URLPart, value: string | object | number | undefined, fn?: boolean | URLParse.QueryParser): URLParse;
|
43 | toString(): string;
|
44 | }
|
45 |
|
46 | declare const URLParse: {
|
47 | new(address: string, parser?: boolean | URLParse.QueryParser): URLParse;
|
48 | new(address: string, location?: string | object, parser?: boolean | URLParse.QueryParser): URLParse;
|
49 | (address: string, parser?: boolean | URLParse.QueryParser): URLParse;
|
50 | (address: string, location?: string | object, parser?: boolean | URLParse.QueryParser): URLParse;
|
51 |
|
52 | extractProtocol(url: string): {
|
53 | slashes: boolean;
|
54 | protocol: string;
|
55 | rest: string;
|
56 | };
|
57 | location(url: string): object;
|
58 | qs: {
|
59 | parse: URLParse.QueryParser;
|
60 | stringify(query: object): string;
|
61 | };
|
62 | };
|
63 |
|
64 | export = URLParse;
|