mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
add extra parse signature
This commit is contained in:
Vendored
+5
-1
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user