1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | interface HTMLElement {}
|
10 |
|
11 | export = URI;
|
12 | export as namespace URI;
|
13 |
|
14 | declare const URI: {
|
15 | (value?: string | URI.URIOptions | HTMLElement, base?: string | URI): URI;
|
16 |
|
17 | new(value?: string | URI.URIOptions | HTMLElement, base?: string | URI): URI;
|
18 |
|
19 | addQuery(data: URI.QueryDataMap, prop: string, value: string): object;
|
20 | addQuery(data: URI.QueryDataMap, qryObj: object): object;
|
21 |
|
22 | build(parts: URI.URIOptions): string;
|
23 | buildAuthority(
|
24 | parts: {
|
25 | username?: string | undefined;
|
26 | password?: string | undefined;
|
27 | hostname?: string | undefined;
|
28 | port?: string | undefined;
|
29 | },
|
30 | ): string;
|
31 | buildHost(parts: { hostname?: string | undefined; port?: string | undefined }): string;
|
32 | buildQuery(data: URI.QueryDataMap, duplicateQueryParameters?: boolean, escapeQuerySpace?: boolean): string;
|
33 | buildUserinfo(parts: { username?: string | undefined; password?: string | undefined }): string;
|
34 |
|
35 | commonPath(path1: string, path2: string): string;
|
36 |
|
37 | decode(str: string): string;
|
38 | decodeQuery(qry: string): string;
|
39 |
|
40 | duplicateQueryParameters: boolean;
|
41 |
|
42 | encode(str: string): string;
|
43 | encodeQuery(qry: string): string;
|
44 | encodeReserved(str: string): string;
|
45 |
|
46 | escapeQuerySpace: boolean;
|
47 |
|
48 | |
49 |
|
50 |
|
51 |
|
52 | expand?: ((template: string, vals: object) => string) | undefined;
|
53 |
|
54 | iso8859(): void;
|
55 |
|
56 | joinPaths(...paths: Array<string | URI>): URI;
|
57 |
|
58 | parse(url: string): URI.Parts;
|
59 | parseAuthority(
|
60 | url: string,
|
61 | parts: {
|
62 | username?: string | undefined;
|
63 | password?: string | undefined;
|
64 | hostname?: string | undefined;
|
65 | port?: string | undefined;
|
66 | },
|
67 | ): string;
|
68 | parseHost(
|
69 | url: string,
|
70 | parts: {
|
71 | hostname?: string | undefined;
|
72 | port?: string | undefined;
|
73 | },
|
74 | ): string;
|
75 | parseQuery(url: string): URI.QueryDataMap;
|
76 | parseUserinfo(
|
77 | url: string,
|
78 | parts: {
|
79 | username?: string | undefined;
|
80 | password?: string | undefined;
|
81 | },
|
82 | ): string;
|
83 |
|
84 | preventInvalidHostname: boolean;
|
85 |
|
86 | removeQuery(data: object, prop: string, value: string): object;
|
87 | removeQuery(data: object, props: string[] | object): object;
|
88 |
|
89 | unicode(): void;
|
90 |
|
91 | withinString(source: string, func: (url: string, start: number, end: number, source: string) => string): string;
|
92 | };
|
93 |
|
94 | declare namespace URI {
|
95 | interface URIOptions {
|
96 | protocol?: string | undefined;
|
97 | username?: string | undefined;
|
98 | password?: string | undefined;
|
99 | hostname?: string | undefined;
|
100 | port?: string | undefined;
|
101 | path?: string | undefined;
|
102 | query?: string | undefined;
|
103 | fragment?: string | undefined;
|
104 | urn?: boolean | undefined;
|
105 | }
|
106 |
|
107 | interface Parts extends URIOptions {
|
108 | duplicateQueryParameters: boolean;
|
109 | escapeQuerySpace: boolean;
|
110 | preventInvalidHostname: boolean;
|
111 | }
|
112 |
|
113 | type QueryDataMap = Partial<Record<string, any>>;
|
114 |
|
115 | interface ReadonlyURI {
|
116 | clone(): URI;
|
117 |
|
118 | authority(): string;
|
119 | directory(dir?: boolean): string;
|
120 | domain(domain?: boolean): string;
|
121 | filename(file?: boolean): string;
|
122 | fragment(): string;
|
123 | hash(): string;
|
124 | host(): string;
|
125 | hostname(): string;
|
126 | href(): string;
|
127 | origin(): string;
|
128 | password(): string;
|
129 | path(path?: boolean): string;
|
130 | pathname(path?: boolean): string;
|
131 | port(): string;
|
132 | protocol(): string;
|
133 | query(): string;
|
134 | query(v: boolean): QueryDataMap;
|
135 | readable(): string;
|
136 | resource(): string;
|
137 | scheme(): string;
|
138 | search(): string;
|
139 | search(v: boolean): QueryDataMap;
|
140 | segment(): string[];
|
141 | segment(position: number): string | undefined;
|
142 | segmentCoded(): string[];
|
143 | segmentCoded(position: number): string;
|
144 | subdomain(): string;
|
145 | suffix(suffix?: boolean): string;
|
146 | tld(tld?: boolean): string;
|
147 | userinfo(): string;
|
148 | username(): string;
|
149 | valueOf(): string;
|
150 |
|
151 | equals(url?: string | ReadonlyURI | URI): boolean;
|
152 | is(
|
153 | qry:
|
154 | | "relative"
|
155 | | "absolute"
|
156 | | "urn"
|
157 | | "url"
|
158 | | "domain"
|
159 | | "name"
|
160 | | "sld"
|
161 | | "idn"
|
162 | | "punycode"
|
163 | | "ip"
|
164 | | "ip4"
|
165 | | "ipv4"
|
166 | | "inet4"
|
167 | | "ip6"
|
168 | | "ipv6"
|
169 | | "inet6",
|
170 | ): boolean;
|
171 |
|
172 | hasQuery(
|
173 | name: any,
|
174 | value?: string | number | boolean | string[] | number[] | boolean[] | RegExp | ((...args: any[]) => any),
|
175 | withinArray?: boolean,
|
176 | ): boolean;
|
177 | hasSearch(
|
178 | name: any,
|
179 | value?: string | number | boolean | string[] | number[] | boolean[] | RegExp | ((...args: any[]) => any),
|
180 | withinArray?: boolean,
|
181 | ): boolean;
|
182 | }
|
183 | }
|
184 |
|
185 | interface URI {
|
186 | absoluteTo(path: string | URI): URI;
|
187 | addFragment(fragment: string): URI;
|
188 | addQuery(qry: string | URI.QueryDataMap): URI;
|
189 | addQuery(qry: string, value: any): URI;
|
190 | addSearch(qry: string | URI.QueryDataMap): URI;
|
191 | addSearch(key: string, value: any): URI;
|
192 | authority(): string;
|
193 | authority(authority: string): URI;
|
194 |
|
195 | clone(): URI;
|
196 |
|
197 | directory(dir?: boolean): string;
|
198 | directory(dir: string): URI;
|
199 | domain(domain?: boolean): string;
|
200 | domain(domain: string): URI;
|
201 |
|
202 | duplicateQueryParameters(val: boolean): URI;
|
203 |
|
204 | equals(url?: string | URI): boolean;
|
205 |
|
206 | escapeQuerySpace(val: boolean): URI;
|
207 |
|
208 | filename(file?: boolean): string;
|
209 | filename(file: string): URI;
|
210 | fragment(): string;
|
211 | fragment(fragment: string): URI;
|
212 | fragmentPrefix(prefix: string): URI;
|
213 |
|
214 | hash(): string;
|
215 | hash(hash: string): URI;
|
216 | host(): string;
|
217 | host(host: string): URI;
|
218 | hostname(): string;
|
219 | hostname(hostname: string): URI;
|
220 | href(): string;
|
221 | href(url: string): void;
|
222 |
|
223 | is(
|
224 | qry:
|
225 | | "relative"
|
226 | | "absolute"
|
227 | | "urn"
|
228 | | "url"
|
229 | | "domain"
|
230 | | "name"
|
231 | | "sld"
|
232 | | "idn"
|
233 | | "punycode"
|
234 | | "ip"
|
235 | | "ip4"
|
236 | | "ipv4"
|
237 | | "inet4"
|
238 | | "ip6"
|
239 | | "ipv6"
|
240 | | "inet6",
|
241 | ): boolean;
|
242 | iso8859(): URI;
|
243 |
|
244 | normalize(): URI;
|
245 | normalizeFragment(): URI;
|
246 | normalizeHash(): URI;
|
247 | normalizeHostname(): URI;
|
248 | normalizePath(): URI;
|
249 | normalizePathname(): URI;
|
250 | normalizePort(): URI;
|
251 | normalizeProtocol(): URI;
|
252 | normalizeQuery(): URI;
|
253 | normalizeSearch(): URI;
|
254 |
|
255 | origin(): string;
|
256 | origin(uri: string | URI): URI;
|
257 |
|
258 | password(): string;
|
259 | password(pw: string): URI;
|
260 | path(path?: boolean): string;
|
261 | path(path: string): URI;
|
262 | pathname(path?: boolean): string;
|
263 | pathname(path: string): URI;
|
264 | port(): string;
|
265 | port(port: string): URI;
|
266 | protocol(): string;
|
267 | protocol(protocol: string): URI;
|
268 |
|
269 | preventInvalidHostname(val: boolean): URI;
|
270 |
|
271 | query(): string;
|
272 | // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
273 | query(qry: string | URI.QueryDataMap | ((qryObject: URI.QueryDataMap) => URI.QueryDataMap | void)): URI;
|
274 | query(v: boolean): URI.QueryDataMap;
|
275 |
|
276 | readable(): string;
|
277 | relativeTo(path: string): URI;
|
278 | removeQuery(qry: string | URI.QueryDataMap): URI;
|
279 | removeQuery(name: string, value: string): URI;
|
280 | removeSearch(qry: string | URI.QueryDataMap): URI;
|
281 | removeSearch(name: string, value: string): URI;
|
282 | resource(): string;
|
283 | resource(resource: string): URI;
|
284 |
|
285 | scheme(): string;
|
286 | scheme(protocol: string): URI;
|
287 | search(): string;
|
288 | // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
289 | search(qry: string | URI.QueryDataMap | ((qryObject: URI.QueryDataMap) => URI.QueryDataMap | void)): URI;
|
290 | search(v: boolean): URI.QueryDataMap;
|
291 | segment(): string[];
|
292 | segment(segments: string[] | string): URI;
|
293 | segment(position: number): string | undefined;
|
294 | segment(position: number, level: string): URI;
|
295 | segmentCoded(): string[];
|
296 | segmentCoded(segments: string[] | string): URI;
|
297 | segmentCoded(position: number): string;
|
298 | segmentCoded(position: number, level: string): URI;
|
299 | setQuery(key: string, value: any): URI;
|
300 | setQuery(qry: URI.QueryDataMap): URI;
|
301 | setSearch(key: string, value: any): URI;
|
302 | setSearch(qry: URI.QueryDataMap): URI;
|
303 | hasQuery(
|
304 | name: any,
|
305 | value?: string | number | boolean | string[] | number[] | boolean[] | RegExp | ((...args: any[]) => any),
|
306 | withinArray?: boolean,
|
307 | ): boolean;
|
308 | hasSearch(
|
309 | name: any,
|
310 | value?: string | number | boolean | string[] | number[] | boolean[] | RegExp | ((...args: any[]) => any),
|
311 | withinArray?: boolean,
|
312 | ): boolean;
|
313 | subdomain(): string;
|
314 | subdomain(subdomain: string): URI;
|
315 | suffix(suffix?: boolean): string;
|
316 | suffix(suffix: string): URI;
|
317 |
|
318 | tld(tld?: boolean): string;
|
319 | tld(tld: string): URI;
|
320 |
|
321 | unicode(): URI;
|
322 | userinfo(): string;
|
323 | userinfo(userinfo: string): URI;
|
324 | username(): string;
|
325 | username(uname: string): URI;
|
326 |
|
327 | valueOf(): string;
|
328 | }
|
329 |
|
330 | declare global {
|
331 | interface JQuery {
|
332 | uri(): URI;
|
333 | }
|
334 | }
|
335 |
|
336 | declare module "URI" {
|
337 | export = URI;
|
338 | }
|
339 |
|
\ | No newline at end of file |