reorder signatures; implement constructor signature

This commit is contained in:
davidgoli 2019-01-04 10:23:21 -08:00
parent 8d21ac9216
commit 23df99dcee
2 changed files with 3 additions and 1 deletions

View File

@ -44,9 +44,10 @@ interface URLParse {
}
declare const URLParse: {
new(address: string, parser?: boolean | URLParse.QueryParser): URLParse;
new(address: string, location?: string | object, parser?: boolean | URLParse.QueryParser): URLParse;
(address: string, location?: string | object, parser?: boolean | URLParse.QueryParser): URLParse;
(address: string, parser?: boolean | URLParse.QueryParser): URLParse;
(address: string, location?: string | object, parser?: boolean | URLParse.QueryParser): URLParse;
extractProtocol(url: string): {
slashes: boolean;

View File

@ -3,6 +3,7 @@ const parse = URL;
new URL('foo/bar', 'https://github.com/');
new URL('foo/bar', 'https://github.com/', (query: string) => ({ query }));
new URL('foo/bar', 'https://github.com/', true);
parse('foo/bar', 'https://github.com/');
parse('foo/bar', 'https://github.com/', (query: string) => ({ query }));
const result = parse('foo/bar?baz=quux', true);