mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Corrected Nodejs querystring (un)escape definitions
This commit is contained in:
@@ -10,6 +10,7 @@ import crypto = require("crypto");
|
||||
import http = require("http");
|
||||
import net = require("net");
|
||||
import dgram = require("dgram");
|
||||
import querystring = require('querystring');
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
@@ -122,4 +123,14 @@ var ai: dgram.AddressInfo = ds.address();
|
||||
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
///Querystring tests : https://gist.github.com/musubu/2202583
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
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
|
||||
|
||||
4
node/node-0.11.d.ts
vendored
4
node/node-0.11.d.ts
vendored
@@ -250,8 +250,8 @@ 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 function escape(): any;
|
||||
export function unescape(): any;
|
||||
export function escape(str: string): string;
|
||||
export function unescape(str: string): string;
|
||||
}
|
||||
|
||||
declare module "events" {
|
||||
|
||||
4
node/node-0.8.8.d.ts
vendored
4
node/node-0.8.8.d.ts
vendored
@@ -203,8 +203,8 @@ interface 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 function escape(): any;
|
||||
export function unescape(): any;
|
||||
export function escape(str: string): string;
|
||||
export function unescape(str: string): string;
|
||||
}
|
||||
|
||||
declare module "events" {
|
||||
|
||||
@@ -10,6 +10,7 @@ import crypto = require("crypto");
|
||||
import http = require("http");
|
||||
import net = require("net");
|
||||
import dgram = require("dgram");
|
||||
import querystring = require('querystring');
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
@@ -165,4 +166,14 @@ var ai: dgram.AddressInfo = ds.address();
|
||||
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
///Querystring tests : https://gist.github.com/musubu/2202583
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
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
|
||||
|
||||
4
node/node.d.ts
vendored
4
node/node.d.ts
vendored
@@ -250,8 +250,8 @@ 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 function escape(): any;
|
||||
export function unescape(): any;
|
||||
export function escape(str: string): string;
|
||||
export function unescape(str: string): string;
|
||||
}
|
||||
|
||||
declare module "events" {
|
||||
|
||||
Reference in New Issue
Block a user