From 4b232a12142f0b4751f1e2da059a2bfebe9a4f78 Mon Sep 17 00:00:00 2001 From: Joe Herman Date: Wed, 6 Aug 2014 12:47:48 -0400 Subject: [PATCH 1/6] async: Corrected APIs from forEach* to each* --- async/async-tests.ts | 5 +++-- async/async.d.ts | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/async/async-tests.ts b/async/async-tests.ts index 9b0c8e7ee..9a563276a 100644 --- a/async/async-tests.ts +++ b/async/async-tests.ts @@ -26,10 +26,11 @@ async.map(data, asyncProcess, function (err, results) { var openFiles = ['file1', 'file2']; var saveFile = function () { } -async.forEach(openFiles, saveFile, function (err) { }); +async.each(openFiles, saveFile, function (err) { }); +async.eachSeries(openFiles, saveFile, function (err) { }); var documents, requestApi; -async.forEachLimit(documents, 20, requestApi, function (err) { }); +async.eachLimit(documents, 20, requestApi, function (err) { }); async.map(['file1', 'file2', 'file3'], fs.stat, function (err, results) { }); diff --git a/async/async.d.ts b/async/async.d.ts index d1d592629..994ed1799 100644 --- a/async/async.d.ts +++ b/async/async.d.ts @@ -34,9 +34,9 @@ interface AsyncQueue { interface Async { // Collections - forEach(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; - forEachSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; - forEachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; + each(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; + eachSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; + eachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; map(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; mapSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; filter(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; From 53d09fb8068f66a6625580a793a8a4bfddb82c8e Mon Sep 17 00:00:00 2001 From: Evgenus Date: Wed, 6 Aug 2014 23:11:18 +0300 Subject: [PATCH 2/6] comments enhanced to jsDoc format --- bigint/bigint.d.ts | 364 ++++++++++++++++++++++++++++++--------------- 1 file changed, 245 insertions(+), 119 deletions(-) diff --git a/bigint/bigint.d.ts b/bigint/bigint.d.ts index 61543b1c6..b70f20fa4 100644 --- a/bigint/bigint.d.ts +++ b/bigint/bigint.d.ts @@ -13,233 +13,359 @@ declare module BigInt { export function setRandom(random: IRandom): void; - // bigInt add(x,y) - // return (x+y) for bigInts x and y. + /** + * bigInt add(x,y) + * return (x+y) for bigInts x and y. + */ export function add(x: BigInt, y: BigInt): BigInt; - // bigInt addInt(x,n) - // return (x+n) where x is a bigInt and n is an integer. + /** + * bigInt addInt(x,n) + * return (x+n) where x is a bigInt and n is an integer. + */ export function addInt(x: BigInt, n: number): BigInt; - // string bigInt2str(x,base) - // return a string form of bigInt x in a given base, with 2 <= base <= 95 - export function bigInt2str(x: BigInt, base: number): string; - export function bigInt2str(x: BigInt, base: string): string; + interface bigInt2str_T { + /** + * string bigInt2str(x,base) + * return a string form of bigInt x in a given base, with 2 <= base <= 95 + */ + (x: BigInt, base: T): string; + } - // int bitSize(x) - // return how many bits long the bigInt x is, not counting leading zeros + interface bigInt2strSignature extends bigInt2str_T, bigInt2str_T{ + } + + export var bigInt2str: bigInt2strSignature; + + /** + * int bitSize(x) + * return how many bits long the bigInt x is, not counting leading zeros + */ export function bitSize(x: BigInt): number; - // bigInt dup(x) - // return a copy of bigInt x + /** + * bigInt dup(x) + * return a copy of bigInt x + */ export function dup(x: BigInt): BigInt; - // boolean equals(x,y) - // is the bigInt x equal to the bigint y? + /** + * boolean equals(x,y) + * is the bigInt x equal to the bigint y? + */ export function equals(x: BigInt, y: BigInt): boolean; - // boolean equalsInt(x,y) - // is bigint x equal to integer y? + /** + * boolean equalsInt(x,y) + * is bigint x equal to integer y? + */ export function equalsInt(x: BigInt, y: number): boolean; - // bigInt expand(x,n) - // return a copy of x with at least n elements, adding leading zeros if needed + /** + * bigInt expand(x,n) + * return a copy of x with at least n elements, adding leading zeros if needed + */ export function expand(value: BigInt, n: number): BigInt; - // Array findPrimes(n) - // return array of all primes less than integer n + /** + * Array findPrimes(n) + * return array of all primes less than integer n + */ export function findPrimes(n: number): number[]; - // bigInt GCD(x,y) - // return greatest common divisor of bigInts x and y (each with same number of elements). + /** + * bigInt GCD(x,y) + * return greatest common divisor of bigInts x and y (each with same number of elements). + */ export function GCD(x: BigInt, y: BigInt): BigInt; - // boolean greater(x,y) - // is x>y? (x and y are nonnegative bigInts) + /** + * boolean greater(x,y) + * is x>y? (x and y are nonnegative bigInts) + */ export function greater(x: BigInt, y: BigInt): boolean; - // boolean greaterShift(x,y,shift) - // is (x <<(shift*bpe)) > y? + /** + * boolean greaterShift(x,y,shift) + * is (x <<(shift*bpe)) > y? + */ export function greaterShift(x: BigInt, y: BigInt, shift: number): boolean; - // bigInt int2bigInt(t,n,m) - // return a bigInt equal to integer t, with at least n bits and m array elements + /** + * bigInt int2bigInt(t,n,m) + * return a bigInt equal to integer t, with at least n bits and m array elements + */ export function int2bigInt(t: number, n?: number, m?: number): BigInt; - // bigInt inverseMod(x,n) - // return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null + /** + * bigInt inverseMod(x,n) + * return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null + */ export function inverseMod(x: BigInt, n: BigInt): BigInt; - // int inverseModInt(x,n) - // return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse + /** + * int inverseModInt(x,n) + * return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse + */ export function inverseModInt(x: number, n: number): BigInt; - // boolean isZero(x) - // is the bigInt x equal to zero? + /** + * boolean isZero(x) + * is the bigInt x equal to zero? + */ export function isZero(x: BigInt): boolean; - // boolean millerRabin(x,b) - // does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is bigInt, 1=1). If s=1, then the most significant of those n bits is set to 1. + /** + * bigInt randBigInt(n,s) + * return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1. + */ export function randBigInt(n: number, s: number): BigInt; - // bigInt randTruePrime(k) - // return a new, random, k-bit, true prime bigInt using Maurer's algorithm. + /** + * bigInt randTruePrime(k) + * return a new, random, k-bit, true prime bigInt using Maurer's algorithm. + */ export function randTruePrime(k: number): BigInt; - // bigInt randProbPrime(k) - // return a new, random, k-bit, probable prime bigInt (probability it's composite less than 2^-80). + /** + * bigInt randProbPrime(k) + * return a new, random, k-bit, probable prime bigInt (probability it's composite less than 2^-80). + */ export function randProbPrime(k: number): BigInt; - // bigInt str2bigInt(s,b,n,m) - // return a bigInt for number represented in string s in base b with at least n bits and m array elements - export function str2bigInt(s: string, b: number, n?: number, m?: number): BigInt; - export function str2bigInt(s: string, b: string, n?: number, m?: number): BigInt; + interface str2bigInt_T { + /** + * bigInt str2bigInt(s,b,n,m) + * return a bigInt for number represented in string s in base b with at least n bits and m array elements + */ + (s: string, b: T, n?: number, m?: number): BigInt; + } - // bigInt sub(x,y) - // return (x-y) for bigInts x and y. Negative answers will be 2s complement + interface str2bigIntSignature extends str2bigInt_T, str2bigInt_T { + } + + export var str2bigInt: str2bigIntSignature; + + /** + * bigInt sub(x,y) + * return (x-y) for bigInts x and y. Negative answers will be 2s complement + */ export function sub(x: BigInt, y: BigInt): BigInt; - // bigInt trim(x,k) - // return a copy of x with exactly k leading zero elements + /** + * bigInt trim(x,k) + * return a copy of x with exactly k leading zero elements + */ export function trim(x: BigInt, k: number): BigInt; - // void addInt_(x,n) - // do x=x+n where x is a bigInt and n is an integer + /** + * void addInt_(x,n) + * do x=x+n where x is a bigInt and n is an integer + */ export function addInt_(x: BigInt, n: number): void; - // void add_(x,y) - // do x=x+y for bigInts x and y + /** + * void add_(x,y) + * do x=x+y for bigInts x and y + */ export function add_(x: BigInt, y: BigInt): void; - // void copy_(x,y) - // do x=y on bigInts x and y + /** + * void copy_(x,y) + * do x=y on bigInts x and y + */ export function copy_(x: BigInt, y: BigInt): void; - // void copyInt_(x,n) - // do x=n on bigInt x and integer n + /** + * void copyInt_(x,n) + * do x=n on bigInt x and integer n + */ export function copyInt_(x: BigInt, n: number): number; - // void GCD_(x,y) - // set x to the greatest common divisor of bigInts x and y, (y is destroyed). (This never overflows its array). + /** + * void GCD_(x,y) + * set x to the greatest common divisor of bigInts x and y, (y is destroyed). (This never overflows its array). + */ export function GCD_(x: BigInt, y: BigInt): void; - // boolean inverseMod_(x,n) - // do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist + /** + * boolean inverseMod_(x,n) + * do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist + */ export function inverseMod_(x: BigInt, n: BigInt): boolean; - // void mod_(x,n) - // do x=x mod n for bigInts x and n. (This never overflows its array). + /** + * void mod_(x,n) + * do x=x mod n for bigInts x and n. (This never overflows its array). + */ export function mod_(x: BigInt, n: BigInt): void; - // void mult_(x,y) - // do x=x*y for bigInts x and y. + /** + * void mult_(x,y) + * do x=x*y for bigInts x and y. + */ export function mult_(x: BigInt, y: BigInt): void; - // void multMod_(x,y,n) - // do x=x*y mod n for bigInts x,y,n. + /** + * void multMod_(x,y,n) + * do x=x*y mod n for bigInts x,y,n. + */ export function multMod_(x: BigInt, y: BigInt, n: BigInt): void; - // void powMod_(x,y,n) - // do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1. + /** + * void powMod_(x,y,n) + * do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1. + */ export function powMod_(x: BigInt, y: BigInt, n: BigInt): void; - // void randBigInt_(b,n,s) - // do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1. + /** + * void randBigInt_(b,n,s) + * do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1. + */ export function randBigInt_(b: BigInt, n: number, s: number): void; - // void randTruePrime_(ans,k) - // do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb. + /** + * void randTruePrime_(ans,k) + * do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb. + */ export function randTruePrime_(ans: BigInt, k: number): void; - // void sub_(x,y) - // do x=x-y for bigInts x and y. Negative answers will be 2s complement. + /** + * void sub_(x,y) + * do x=x-y for bigInts x and y. Negative answers will be 2s complement. + */ export function sub_(x: BigInt, y: BigInt): void; - // void addShift_(x,y,ys) - // do x=x+(y<<(ys*bpe)) + /** + * void addShift_(x,y,ys) + * do x=x+(y<<(ys*bpe)) + */ export function addShift_(x: BigInt, y: BigInt, ys: number): void; - // void carry_(x) - // do carries and borrows so each element of the bigInt x fits in bpe bits. + /** + * void carry_(x) + * do carries and borrows so each element of the bigInt x fits in bpe bits. + */ export function carry_(x: BigInt): void; - // void divide_(x,y,q,r) - // divide x by y giving quotient q and remainder r + /** + * void divide_(x,y,q,r) + * divide x by y giving quotient q and remainder r + */ export function divide_(x: BigInt, y: BigInt, q: BigInt, r: BigInt): void; - // int divInt_(x,n) - // do x=floor(x/n) for bigInt x and integer n, and return the remainder. (This never overflows its array). + /** + * int divInt_(x,n) + * do x=floor(x/n) for bigInt x and integer n, and return the remainder. (This never overflows its array). + */ export function divInt_(x: BigInt, n: number): number; - // void eGCD_(x,y,d,a,b) - // sets a,b,d to positive bigInts such that d = GCD_(x,y) = a*x-b*y + /** + * void eGCD_(x,y,d,a,b) + * sets a,b,d to positive bigInts such that d = GCD_(x,y) = a*x-b*y + */ export function eGCD_(x: BigInt, y: BigInt, d: BigInt, a: BigInt, b: BigInt): void; - // void halve_(x) - // do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement. (This never overflows its array). + /** + * void halve_(x) + * do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement. (This never overflows its array). + */ export function halve_(x: BigInt): void; - // void leftShift_(x,n) - // left shift bigInt x by n bits. n Date: Thu, 7 Aug 2014 15:01:57 +0900 Subject: [PATCH 3/6] Added property upgradeReq --- ws/ws.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ws/ws.d.ts b/ws/ws.d.ts index d12e2913f..99983df85 100644 --- a/ws/ws.d.ts +++ b/ws/ws.d.ts @@ -21,6 +21,7 @@ declare module "ws" { protocolVersion: string; url: string; supports: any; + upgradeReq: http.ServerRequest; CONNECTING: number; OPEN: number; From 9a4229df7e1d20ae547bd37b92d7e961cfbfe4f9 Mon Sep 17 00:00:00 2001 From: vvakame Date: Thu, 7 Aug 2014 15:50:27 +0900 Subject: [PATCH 4/6] fix -test.ts to -tests.ts --- bucks/{bucks-test.ts => bucks-tests.ts} | 0 .../{http-string-parser-test.ts => http-string-parser-tests.ts} | 0 .../{jquery.notifyBar-test.ts => jquery.notifyBar-tests.ts} | 0 js-git/{js-git-test.ts => js-git-tests.ts} | 0 js-url/{js-url-test.ts => js-url-tests.ts} | 0 .../{passport-facebook-test.ts => passport-facebook-tests.ts} | 0 .../{passport-strategy-test.ts => passport-strategy-tests.ts} | 0 riotjs/{riotjs-test.ts => riotjs-tests.ts} | 0 .../{simple-cw-node-test.ts => simple-cw-node-tests.ts} | 0 tspromise/{tspromise-test.ts => tspromise-tests.ts} | 0 .../{universal-analytics-test.ts => universal-analytics-tests.ts} | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename bucks/{bucks-test.ts => bucks-tests.ts} (100%) rename http-string-parser/{http-string-parser-test.ts => http-string-parser-tests.ts} (100%) rename jquery.notifyBar/{jquery.notifyBar-test.ts => jquery.notifyBar-tests.ts} (100%) rename js-git/{js-git-test.ts => js-git-tests.ts} (100%) rename js-url/{js-url-test.ts => js-url-tests.ts} (100%) rename passport-facebook/{passport-facebook-test.ts => passport-facebook-tests.ts} (100%) rename passport-strategy/{passport-strategy-test.ts => passport-strategy-tests.ts} (100%) rename riotjs/{riotjs-test.ts => riotjs-tests.ts} (100%) rename simple-cw-node/{simple-cw-node-test.ts => simple-cw-node-tests.ts} (100%) rename tspromise/{tspromise-test.ts => tspromise-tests.ts} (100%) rename universal-analytics/{universal-analytics-test.ts => universal-analytics-tests.ts} (100%) diff --git a/bucks/bucks-test.ts b/bucks/bucks-tests.ts similarity index 100% rename from bucks/bucks-test.ts rename to bucks/bucks-tests.ts diff --git a/http-string-parser/http-string-parser-test.ts b/http-string-parser/http-string-parser-tests.ts similarity index 100% rename from http-string-parser/http-string-parser-test.ts rename to http-string-parser/http-string-parser-tests.ts diff --git a/jquery.notifyBar/jquery.notifyBar-test.ts b/jquery.notifyBar/jquery.notifyBar-tests.ts similarity index 100% rename from jquery.notifyBar/jquery.notifyBar-test.ts rename to jquery.notifyBar/jquery.notifyBar-tests.ts diff --git a/js-git/js-git-test.ts b/js-git/js-git-tests.ts similarity index 100% rename from js-git/js-git-test.ts rename to js-git/js-git-tests.ts diff --git a/js-url/js-url-test.ts b/js-url/js-url-tests.ts similarity index 100% rename from js-url/js-url-test.ts rename to js-url/js-url-tests.ts diff --git a/passport-facebook/passport-facebook-test.ts b/passport-facebook/passport-facebook-tests.ts similarity index 100% rename from passport-facebook/passport-facebook-test.ts rename to passport-facebook/passport-facebook-tests.ts diff --git a/passport-strategy/passport-strategy-test.ts b/passport-strategy/passport-strategy-tests.ts similarity index 100% rename from passport-strategy/passport-strategy-test.ts rename to passport-strategy/passport-strategy-tests.ts diff --git a/riotjs/riotjs-test.ts b/riotjs/riotjs-tests.ts similarity index 100% rename from riotjs/riotjs-test.ts rename to riotjs/riotjs-tests.ts diff --git a/simple-cw-node/simple-cw-node-test.ts b/simple-cw-node/simple-cw-node-tests.ts similarity index 100% rename from simple-cw-node/simple-cw-node-test.ts rename to simple-cw-node/simple-cw-node-tests.ts diff --git a/tspromise/tspromise-test.ts b/tspromise/tspromise-tests.ts similarity index 100% rename from tspromise/tspromise-test.ts rename to tspromise/tspromise-tests.ts diff --git a/universal-analytics/universal-analytics-test.ts b/universal-analytics/universal-analytics-tests.ts similarity index 100% rename from universal-analytics/universal-analytics-test.ts rename to universal-analytics/universal-analytics-tests.ts From 54d719d86ed92466b02f3020f0e510145db02f9d Mon Sep 17 00:00:00 2001 From: Antoine Pultier Date: Thu, 7 Aug 2014 10:42:05 +0200 Subject: [PATCH 5/6] [Leaflet] Optional context argument in L.DomEvent.removeListener --- leaflet/leaflet.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index 3332f9000..006d16c1e 100644 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -574,7 +574,7 @@ declare module L { /** * Removes an event listener from the element. */ - static removeListener(el: HTMLElement, type: string, fn: (e: Event) => void): DomEvent; + static removeListener(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent; /** * Stop the given event from propagation to parent elements. Used inside the From c1858577da71e678d994179dbe65c81258e7dc85 Mon Sep 17 00:00:00 2001 From: Antoine Pultier Date: Thu, 7 Aug 2014 10:42:43 +0200 Subject: [PATCH 6/6] [Leaflet] on and off alias for L.DomEvent --- leaflet/leaflet.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index 006d16c1e..a1276cbe9 100644 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -570,11 +570,13 @@ declare module L { * inside the listener will point to context, or to the element if not specified. */ static addListener(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent; + static on(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent; /** * Removes an event listener from the element. */ static removeListener(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent; + static off(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent; /** * Stop the given event from propagation to parent elements. Used inside the