1 | # Installation
|
2 | > `npm install --save @types/url-parse`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for url-parse (https://github.com/unshiftio/url-parse).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/url-parse.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/url-parse/index.d.ts)
|
10 | ````ts
|
11 | // Type definitions for url-parse 1.4
|
12 | // Project: https://github.com/unshiftio/url-parse
|
13 | // Definitions by: Pavlo Chernenko <https://github.com/ChernenkoPaul>
|
14 | // Hari Sivaramakrishnan <https://github.com/harisiva>
|
15 | // Dmitry Dushkin <https://github.com/DimitryDushkin>
|
16 | // David Golightly <https://github.com/davidgoli>
|
17 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
18 | // TypeScript Version: 2.2
|
19 |
|
20 | declare namespace URLParse {
|
21 | type URLPart =
|
22 | | 'auth'
|
23 | | 'hash'
|
24 | | 'host'
|
25 | | 'hostname'
|
26 | | 'href'
|
27 | | 'origin'
|
28 | | 'password'
|
29 | | 'pathname'
|
30 | | 'port'
|
31 | | 'protocol'
|
32 | | 'query'
|
33 | | 'slashes'
|
34 | | 'username';
|
35 |
|
36 | type QueryParser = (query: string) => object;
|
37 |
|
38 | type StringifyQuery = (query: object) => string;
|
39 | }
|
40 |
|
41 | interface URLParse {
|
42 | readonly auth: string;
|
43 | readonly hash: string;
|
44 | readonly host: string;
|
45 | readonly hostname: string;
|
46 | readonly href: string;
|
47 | readonly origin: string;
|
48 | readonly password: string;
|
49 | readonly pathname: string;
|
50 | readonly port: string;
|
51 | readonly protocol: string;
|
52 | readonly query: { [key: string]: string | undefined };
|
53 | readonly slashes: boolean;
|
54 | readonly username: string;
|
55 | set(
|
56 | part: URLParse.URLPart,
|
57 | value: URLParse[URLParse.URLPart] | undefined,
|
58 | fn?: boolean | URLParse.QueryParser,
|
59 | ): URLParse;
|
60 | toString(stringify?: URLParse.StringifyQuery): string;
|
61 | }
|
62 |
|
63 | declare const URLParse: {
|
64 | new (address: string, parser?: boolean | URLParse.QueryParser): URLParse;
|
65 | new (address: string, location?: string | object, parser?: boolean | URLParse.QueryParser): URLParse;
|
66 | (address: string, parser?: boolean | URLParse.QueryParser): URLParse;
|
67 | (address: string, location?: string | object, parser?: boolean | URLParse.QueryParser): URLParse;
|
68 |
|
69 | extractProtocol(url: string): {
|
70 | slashes: boolean;
|
71 | protocol: string;
|
72 | rest: string;
|
73 | };
|
74 | location(url: string): object;
|
75 | qs: {
|
76 | parse: URLParse.QueryParser;
|
77 | stringify: URLParse.StringifyQuery;
|
78 | };
|
79 | };
|
80 |
|
81 | export = URLParse;
|
82 |
|
83 | ````
|
84 |
|
85 | ### Additional Details
|
86 | * Last updated: Thu, 12 Aug 2021 18:01:26 GMT
|
87 | * Dependencies: none
|
88 | * Global values: none
|
89 |
|
90 | # Credits
|
91 | These definitions were written by [Pavlo Chernenko](https://github.com/ChernenkoPaul), [Hari Sivaramakrishnan](https://github.com/harisiva), [Dmitry Dushkin](https://github.com/DimitryDushkin), and [David Golightly](https://github.com/davidgoli).
|
92 |
|
\ | No newline at end of file |