mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
node: signatures of module "querystring" have been changed
This commit is contained in:
parent
4dc5ab8736
commit
0eef583c76
@ -239,16 +239,47 @@ ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: numb
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
///Querystring tests : https://gist.github.com/musubu/2202583
|
||||
///Querystring tests : https://nodejs.org/api/querystring.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
var original: string = 'http://example.com/product/abcde.html';
|
||||
var escaped: string = querystring.escape(original);
|
||||
console.log(escaped);
|
||||
// http%3A%2F%2Fexample.com%2Fproduct%2Fabcde.html
|
||||
var unescaped: string = querystring.unescape(escaped);
|
||||
console.log(unescaped);
|
||||
// http://example.com/product/abcde.html
|
||||
module querystring_tests {
|
||||
type SampleObject = {a: string; b: number;}
|
||||
|
||||
{
|
||||
let obj: SampleObject;
|
||||
let sep: string;
|
||||
let eq: string;
|
||||
let options: querystring.StringifyOptions;
|
||||
let result: string;
|
||||
|
||||
result = querystring.stringify<SampleObject>(obj);
|
||||
result = querystring.stringify<SampleObject>(obj, sep);
|
||||
result = querystring.stringify<SampleObject>(obj, sep, eq);
|
||||
result = querystring.stringify<SampleObject>(obj, sep, eq);
|
||||
result = querystring.stringify<SampleObject>(obj, sep, eq, options);
|
||||
}
|
||||
|
||||
{
|
||||
let str: string;
|
||||
let sep: string;
|
||||
let eq: string;
|
||||
let options: querystring.ParseOptions;
|
||||
let result: SampleObject;
|
||||
|
||||
result = querystring.parse<SampleObject>(str);
|
||||
result = querystring.parse<SampleObject>(str, sep);
|
||||
result = querystring.parse<SampleObject>(str, sep, eq);
|
||||
result = querystring.parse<SampleObject>(str, sep, eq, options);
|
||||
}
|
||||
|
||||
{
|
||||
let str: string;
|
||||
let result: string;
|
||||
|
||||
result = querystring.escape(str);
|
||||
result = querystring.unescape(str);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// path tests : http://nodejs.org/api/path.html
|
||||
|
||||
14
node/node.d.ts
vendored
14
node/node.d.ts
vendored
@ -405,8 +405,18 @@ declare module "buffer" {
|
||||
}
|
||||
|
||||
declare module "querystring" {
|
||||
export function stringify(obj: any, sep?: string, eq?: string): string;
|
||||
export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any;
|
||||
export interface StringifyOptions {
|
||||
encodeURIComponent?: Function;
|
||||
}
|
||||
|
||||
export interface ParseOptions {
|
||||
maxKeys?: number;
|
||||
decodeURIComponent?: Function;
|
||||
}
|
||||
|
||||
export function stringify<T>(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string;
|
||||
export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): any;
|
||||
export function parse<T extends {}>(str: string, sep?: string, eq?: string, options?: ParseOptions): T;
|
||||
export function escape(str: string): string;
|
||||
export function unescape(str: string): string;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user