-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
31 lines (27 loc) · 854 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(function () {
"use strict";
var forAllAsync = require('./forAllAsync').forAllAsync
, arr = 'abcdefghijklmnopqrstuvwxyz'.split('')
, arr2 = 'abcdefghijklmnopqrstuvwxyz'.toUpperCase().split('')
;
forAllAsync([], function () {
throw new Error("Empty array shouldn't be called");
}, 4).then(function () {
console.log('finished empty batch');
});
forAllAsync(arr2, function (complete, item) {
console.log(item);
complete();
}, 4).then(function () {
console.log('finished uppercase batch', arr2.length);
});
forAllAsync(arr, function (complete, item, i) {
var timeout = Math.round(Math.random() * 1000);
setTimeout(function () {
console.log(item, i, timeout);
complete();
}, timeout);
}, 4).then(function () {
console.log('finished lowercase batch', arr.length);
});
}());