add extra parse signature

This commit is contained in:
davidgoli
2019-01-03 18:19:06 -08:00
parent ba83f54a74
commit 8d21ac9216
2 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -1,6 +1,9 @@
// Type definitions for url-parse 1.4
// Project: https://github.com/unshiftio/url-parse
// Definitions by: Pavlo Chernenko <https://github.com/ChernenkoPaul>, Hari Sivaramakrishnan <https://github.com/harisiva>, Dmitry Dushkin <https://github.com/DimitryDushkin>
// Definitions by: Pavlo Chernenko <https://github.com/ChernenkoPaul>
// Hari Sivaramakrishnan <https://github.com/harisiva>
// Dmitry Dushkin <https://github.com/DimitryDushkin>
// David Golightly <https://github.com/davidgoli>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -43,6 +46,7 @@ interface URLParse {
declare const 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;
extractProtocol(url: string): {
slashes: boolean;
+4
View File
@@ -5,6 +5,10 @@ new URL('foo/bar', 'https://github.com/');
new URL('foo/bar', 'https://github.com/', (query: string) => ({ query }));
parse('foo/bar', 'https://github.com/');
parse('foo/bar', 'https://github.com/', (query: string) => ({ query }));
const result = parse('foo/bar?baz=quux', true);
if (result.query.baz !== 'quux') {
throw new Error('bad query parsing');
}
const url1: URL = new URL('https://github.com/foo/bar?baz=true');
url1.hash;