Merge pull request #4148 from JacobDanton/master

Updating async.times and async.timesSeries definitions and adding tests
This commit is contained in:
Horiuchi_H
2015-04-20 10:49:32 +09:00
2 changed files with 14 additions and 4 deletions

View File

@@ -106,6 +106,17 @@ async.series<number>({
},
function (err, results) { });
async.times(5, function(n, next) {
next(null, n)
}, function(err, results) {
console.log(results)
})
async.timesSeries(5, function(n, next) {
next(null, n)
}, function(err, results) {
console.log(results)
})
async.parallel([
function (callback) {

7
async/async.d.ts vendored
View File

@@ -1,4 +1,4 @@
// Type definitions for Async 0.1.23
// Type definitions for Async 0.9.2
// Project: https://github.com/caolan/async
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -9,7 +9,6 @@ interface ErrorCallback { (err?: Error): void; }
interface AsyncResultCallback<T> { (err: Error, result: T): void; }
interface AsyncResultArrayCallback<T> { (err: Error, results: T[]): void; }
interface AsyncResultObjectCallback<T> { (err: Error, results: Dictionary<T>): void; }
interface AsyncTimesCallback<T> { (n: number, callback: AsyncResultArrayCallback<T>): void; }
interface AsyncIterator<T> { (item: T, callback: ErrorCallback): void; }
interface AsyncResultIterator<T, R> { (item: T, callback: AsyncResultCallback<R>): void; }
@@ -105,8 +104,8 @@ interface Async {
apply(fn: Function, ...arguments: any[]): AsyncFunction<any>;
nextTick(callback: Function): void;
times<T> (n: number, callback: AsyncTimesCallback<T>): void;
timesSeries<T> (n: number, callback: AsyncTimesCallback<T>): void;
times<R> (n: number, iterator: AsyncResultIterator<number, R>, callback: AsyncResultArrayCallback<R>): void;
timesSeries<R> (n: number, iterator: AsyncResultIterator<number, R>, callback: AsyncResultArrayCallback<R>): void;
// Utils
memoize(fn: Function, hasher?: Function): Function;