mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #1368 from halfninja/halfninja-node-url
Fix Node url.format() param type
This commit is contained in:
@@ -4,6 +4,7 @@ import assert = require("assert");
|
||||
import fs = require("fs");
|
||||
import events = require("events");
|
||||
import zlib = require("zlib");
|
||||
import url = require('url');
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
@@ -39,6 +40,18 @@ class Networker extends events.EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
url.format(url.parse('http://www.example.com/xyz'));
|
||||
|
||||
// https://google.com/search?q=you're%20a%20lizard%2C%20gary
|
||||
url.format({
|
||||
protocol: 'https',
|
||||
host: "google.com",
|
||||
pathname: 'search',
|
||||
query: { q: "you're a lizard, gary" }
|
||||
});
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Stream tests : http://nodejs.org/api/stream.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
Vendored
+12
-1
@@ -612,8 +612,19 @@ declare module "url" {
|
||||
slashes: boolean;
|
||||
}
|
||||
|
||||
export interface UrlOptions {
|
||||
protocol?: string;
|
||||
auth?: string;
|
||||
hostname?: string;
|
||||
port?: string;
|
||||
host?: string;
|
||||
pathname?: string;
|
||||
search?: string;
|
||||
query?: any;
|
||||
}
|
||||
|
||||
export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url;
|
||||
export function format(url: Url): string;
|
||||
export function format(url: UrlOptions): string;
|
||||
export function resolve(from: string, to: string): string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user