async-rails 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/async-rails/version.rb +1 -1
- data/vendor/assets/javascripts/async.js +501 -427
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cea5f2910562d097102fd9945aa7eb2246cdb7de
|
4
|
+
data.tar.gz: c99ba64dd344ad7dff32effba4b6c5ee1e687602
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 140ee493acbb4b0f3731e63ed3740ac7001c3c31af33101878dd92265cac774b9e24175ae6e2591cd1a9eeb453251db2c755517d76c6d13d4cf2f8ee16b0e340
|
7
|
+
data.tar.gz: 73373fc59cd003760869e372a20ebce34a1d8fcbbbe29243b5696349b1c628d5cf59063d5aac022a72711babcd208a96a7f4747c67e2ea60365896813c2611b8
|
data/lib/async-rails/version.rb
CHANGED
@@ -1,93 +1,25 @@
|
|
1
1
|
(function (global, factory) {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4
|
+
(factory((global.async = global.async || {})));
|
5
5
|
}(this, (function (exports) { 'use strict';
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
* @param {*} thisArg The `this` binding of `func`.
|
14
|
-
* @param {Array} args The arguments to invoke `func` with.
|
15
|
-
* @returns {*} Returns the result of `func`.
|
16
|
-
*/
|
17
|
-
function apply(func, thisArg, args) {
|
18
|
-
switch (args.length) {
|
19
|
-
case 0: return func.call(thisArg);
|
20
|
-
case 1: return func.call(thisArg, args[0]);
|
21
|
-
case 2: return func.call(thisArg, args[0], args[1]);
|
22
|
-
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
23
|
-
}
|
24
|
-
return func.apply(thisArg, args);
|
25
|
-
}
|
26
|
-
|
27
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
28
|
-
var nativeMax = Math.max;
|
29
|
-
|
30
|
-
/**
|
31
|
-
* A specialized version of `baseRest` which transforms the rest array.
|
32
|
-
*
|
33
|
-
* @private
|
34
|
-
* @param {Function} func The function to apply a rest parameter to.
|
35
|
-
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
36
|
-
* @param {Function} transform The rest array transform.
|
37
|
-
* @returns {Function} Returns the new function.
|
38
|
-
*/
|
39
|
-
function overRest$1(func, start, transform) {
|
40
|
-
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
41
|
-
return function() {
|
42
|
-
var args = arguments,
|
43
|
-
index = -1,
|
44
|
-
length = nativeMax(args.length - start, 0),
|
45
|
-
array = Array(length);
|
46
|
-
|
47
|
-
while (++index < length) {
|
48
|
-
array[index] = args[start + index];
|
7
|
+
function slice(arrayLike, start) {
|
8
|
+
start = start|0;
|
9
|
+
var newLen = Math.max(arrayLike.length - start, 0);
|
10
|
+
var newArr = Array(newLen);
|
11
|
+
for(var idx = 0; idx < newLen; idx++) {
|
12
|
+
newArr[idx] = arrayLike[start + idx];
|
49
13
|
}
|
50
|
-
|
51
|
-
var otherArgs = Array(start + 1);
|
52
|
-
while (++index < start) {
|
53
|
-
otherArgs[index] = args[index];
|
54
|
-
}
|
55
|
-
otherArgs[start] = transform(array);
|
56
|
-
return apply(func, this, otherArgs);
|
57
|
-
};
|
58
|
-
}
|
59
|
-
|
60
|
-
/**
|
61
|
-
* This method returns the first argument it receives.
|
62
|
-
*
|
63
|
-
* @static
|
64
|
-
* @since 0.1.0
|
65
|
-
* @memberOf _
|
66
|
-
* @category Util
|
67
|
-
* @param {*} value Any value.
|
68
|
-
* @returns {*} Returns `value`.
|
69
|
-
* @example
|
70
|
-
*
|
71
|
-
* var object = { 'a': 1 };
|
72
|
-
*
|
73
|
-
* console.log(_.identity(object) === object);
|
74
|
-
* // => true
|
75
|
-
*/
|
76
|
-
function identity(value) {
|
77
|
-
return value;
|
78
|
-
}
|
79
|
-
|
80
|
-
// Lodash rest function without function.toString()
|
81
|
-
// remappings
|
82
|
-
function rest(func, start) {
|
83
|
-
return overRest$1(func, start, identity);
|
14
|
+
return newArr;
|
84
15
|
}
|
85
16
|
|
86
17
|
var initialParams = function (fn) {
|
87
|
-
return
|
18
|
+
return function (/*...args, callback*/) {
|
19
|
+
var args = slice(arguments);
|
88
20
|
var callback = args.pop();
|
89
21
|
fn.call(this, args, callback);
|
90
|
-
}
|
22
|
+
};
|
91
23
|
};
|
92
24
|
|
93
25
|
/**
|
@@ -120,6 +52,34 @@ function isObject(value) {
|
|
120
52
|
return value != null && (type == 'object' || type == 'function');
|
121
53
|
}
|
122
54
|
|
55
|
+
var hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
|
56
|
+
var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';
|
57
|
+
|
58
|
+
function fallback(fn) {
|
59
|
+
setTimeout(fn, 0);
|
60
|
+
}
|
61
|
+
|
62
|
+
function wrap(defer) {
|
63
|
+
return function (fn/*, ...args*/) {
|
64
|
+
var args = slice(arguments, 1);
|
65
|
+
defer(function () {
|
66
|
+
fn.apply(null, args);
|
67
|
+
});
|
68
|
+
};
|
69
|
+
}
|
70
|
+
|
71
|
+
var _defer;
|
72
|
+
|
73
|
+
if (hasSetImmediate) {
|
74
|
+
_defer = setImmediate;
|
75
|
+
} else if (hasNextTick) {
|
76
|
+
_defer = process.nextTick;
|
77
|
+
} else {
|
78
|
+
_defer = fallback;
|
79
|
+
}
|
80
|
+
|
81
|
+
var setImmediate$1 = wrap(_defer);
|
82
|
+
|
123
83
|
/**
|
124
84
|
* Take a sync function and make it async, passing its return value to a
|
125
85
|
* callback. This is useful for plugging sync functions into a waterfall,
|
@@ -139,7 +99,7 @@ function isObject(value) {
|
|
139
99
|
* @method
|
140
100
|
* @alias wrapSync
|
141
101
|
* @category Util
|
142
|
-
* @param {Function} func - The synchronous
|
102
|
+
* @param {Function} func - The synchronous function, or Promise-returning
|
143
103
|
* function to convert to an {@link AsyncFunction}.
|
144
104
|
* @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be
|
145
105
|
* invoked with `(args..., callback)`.
|
@@ -186,10 +146,10 @@ function asyncify(func) {
|
|
186
146
|
}
|
187
147
|
// if result is Promise object
|
188
148
|
if (isObject(result) && typeof result.then === 'function') {
|
189
|
-
result.then(function
|
190
|
-
callback
|
191
|
-
}, function
|
192
|
-
callback
|
149
|
+
result.then(function(value) {
|
150
|
+
invokeCallback(callback, null, value);
|
151
|
+
}, function(err) {
|
152
|
+
invokeCallback(callback, err.message ? err : new Error(err));
|
193
153
|
});
|
194
154
|
} else {
|
195
155
|
callback(null, result);
|
@@ -197,19 +157,20 @@ function asyncify(func) {
|
|
197
157
|
});
|
198
158
|
}
|
199
159
|
|
200
|
-
|
201
|
-
|
202
|
-
function supportsAsync() {
|
203
|
-
var supported;
|
160
|
+
function invokeCallback(callback, error, value) {
|
204
161
|
try {
|
205
|
-
|
206
|
-
supported = isAsync(eval('(async function () {})'));
|
162
|
+
callback(error, value);
|
207
163
|
} catch (e) {
|
208
|
-
|
164
|
+
setImmediate$1(rethrow, e);
|
209
165
|
}
|
210
|
-
return supported;
|
211
166
|
}
|
212
167
|
|
168
|
+
function rethrow(error) {
|
169
|
+
throw error;
|
170
|
+
}
|
171
|
+
|
172
|
+
var supportsSymbol = typeof Symbol === 'function';
|
173
|
+
|
213
174
|
function isAsync(fn) {
|
214
175
|
return supportsSymbol && fn[Symbol.toStringTag] === 'AsyncFunction';
|
215
176
|
}
|
@@ -218,22 +179,22 @@ function wrapAsync(asyncFn) {
|
|
218
179
|
return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn;
|
219
180
|
}
|
220
181
|
|
221
|
-
var wrapAsync$1 = supportsAsync() ? wrapAsync : identity;
|
222
|
-
|
223
182
|
function applyEach$1(eachfn) {
|
224
|
-
return
|
225
|
-
var
|
183
|
+
return function(fns/*, ...args*/) {
|
184
|
+
var args = slice(arguments, 1);
|
185
|
+
var go = initialParams(function(args, callback) {
|
226
186
|
var that = this;
|
227
187
|
return eachfn(fns, function (fn, cb) {
|
228
|
-
wrapAsync
|
188
|
+
wrapAsync(fn).apply(that, args.concat(cb));
|
229
189
|
}, callback);
|
230
190
|
});
|
231
191
|
if (args.length) {
|
232
192
|
return go.apply(this, args);
|
233
|
-
}
|
193
|
+
}
|
194
|
+
else {
|
234
195
|
return go;
|
235
196
|
}
|
236
|
-
}
|
197
|
+
};
|
237
198
|
}
|
238
199
|
|
239
200
|
/** Detect free variable `global` from Node.js. */
|
@@ -903,18 +864,19 @@ function createArrayIterator(coll) {
|
|
903
864
|
var i = -1;
|
904
865
|
var len = coll.length;
|
905
866
|
return function next() {
|
906
|
-
return ++i < len ? {
|
907
|
-
}
|
867
|
+
return ++i < len ? {value: coll[i], key: i} : null;
|
868
|
+
}
|
908
869
|
}
|
909
870
|
|
910
871
|
function createES2015Iterator(iterator) {
|
911
872
|
var i = -1;
|
912
873
|
return function next() {
|
913
874
|
var item = iterator.next();
|
914
|
-
if (item.done)
|
875
|
+
if (item.done)
|
876
|
+
return null;
|
915
877
|
i++;
|
916
|
-
return {
|
917
|
-
}
|
878
|
+
return {value: item.value, key: i};
|
879
|
+
}
|
918
880
|
}
|
919
881
|
|
920
882
|
function createObjectIterator(obj) {
|
@@ -923,7 +885,7 @@ function createObjectIterator(obj) {
|
|
923
885
|
var len = okeys.length;
|
924
886
|
return function next() {
|
925
887
|
var key = okeys[++i];
|
926
|
-
return i < len ? {
|
888
|
+
return i < len ? {value: obj[key], key: key} : null;
|
927
889
|
};
|
928
890
|
}
|
929
891
|
|
@@ -937,7 +899,7 @@ function iterator(coll) {
|
|
937
899
|
}
|
938
900
|
|
939
901
|
function onlyOnce(fn) {
|
940
|
-
return function
|
902
|
+
return function() {
|
941
903
|
if (fn === null) throw new Error("Callback was already called.");
|
942
904
|
var callFn = fn;
|
943
905
|
fn = null;
|
@@ -960,15 +922,17 @@ function _eachOfLimit(limit) {
|
|
960
922
|
if (err) {
|
961
923
|
done = true;
|
962
924
|
callback(err);
|
963
|
-
}
|
925
|
+
}
|
926
|
+
else if (value === breakLoop || (done && running <= 0)) {
|
964
927
|
done = true;
|
965
928
|
return callback(null);
|
966
|
-
}
|
929
|
+
}
|
930
|
+
else {
|
967
931
|
replenish();
|
968
932
|
}
|
969
933
|
}
|
970
934
|
|
971
|
-
function replenish() {
|
935
|
+
function replenish () {
|
972
936
|
while (running < limit && !done) {
|
973
937
|
var elem = nextElem();
|
974
938
|
if (elem === null) {
|
@@ -1008,7 +972,7 @@ function _eachOfLimit(limit) {
|
|
1008
972
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
1009
973
|
*/
|
1010
974
|
function eachOfLimit(coll, limit, iteratee, callback) {
|
1011
|
-
|
975
|
+
_eachOfLimit(limit)(coll, wrapAsync(iteratee), callback);
|
1012
976
|
}
|
1013
977
|
|
1014
978
|
function doLimit(fn, limit) {
|
@@ -1030,7 +994,7 @@ function eachOfArrayLike(coll, iteratee, callback) {
|
|
1030
994
|
function iteratorCallback(err, value) {
|
1031
995
|
if (err) {
|
1032
996
|
callback(err);
|
1033
|
-
} else if (++completed === length || value === breakLoop) {
|
997
|
+
} else if ((++completed === length) || value === breakLoop) {
|
1034
998
|
callback(null);
|
1035
999
|
}
|
1036
1000
|
}
|
@@ -1082,14 +1046,14 @@ var eachOfGeneric = doLimit(eachOfLimit, Infinity);
|
|
1082
1046
|
* doSomethingWith(configs);
|
1083
1047
|
* });
|
1084
1048
|
*/
|
1085
|
-
var eachOf = function
|
1049
|
+
var eachOf = function(coll, iteratee, callback) {
|
1086
1050
|
var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric;
|
1087
|
-
eachOfImplementation(coll, wrapAsync
|
1051
|
+
eachOfImplementation(coll, wrapAsync(iteratee), callback);
|
1088
1052
|
};
|
1089
1053
|
|
1090
1054
|
function doParallel(fn) {
|
1091
1055
|
return function (obj, iteratee, callback) {
|
1092
|
-
return fn(eachOf, obj, wrapAsync
|
1056
|
+
return fn(eachOf, obj, wrapAsync(iteratee), callback);
|
1093
1057
|
};
|
1094
1058
|
}
|
1095
1059
|
|
@@ -1098,7 +1062,7 @@ function _asyncMap(eachfn, arr, iteratee, callback) {
|
|
1098
1062
|
arr = arr || [];
|
1099
1063
|
var results = [];
|
1100
1064
|
var counter = 0;
|
1101
|
-
var _iteratee = wrapAsync
|
1065
|
+
var _iteratee = wrapAsync(iteratee);
|
1102
1066
|
|
1103
1067
|
eachfn(arr, function (value, _, callback) {
|
1104
1068
|
var index = counter++;
|
@@ -1186,7 +1150,7 @@ var applyEach = applyEach$1(map);
|
|
1186
1150
|
|
1187
1151
|
function doParallelLimit(fn) {
|
1188
1152
|
return function (obj, limit, iteratee, callback) {
|
1189
|
-
return fn(_eachOfLimit(limit), obj, wrapAsync
|
1153
|
+
return fn(_eachOfLimit(limit), obj, wrapAsync(iteratee), callback);
|
1190
1154
|
};
|
1191
1155
|
}
|
1192
1156
|
|
@@ -1264,10 +1228,11 @@ var applyEachSeries = applyEach$1(mapSeries);
|
|
1264
1228
|
* @memberOf module:Utils
|
1265
1229
|
* @method
|
1266
1230
|
* @category Util
|
1267
|
-
* @param {Function}
|
1231
|
+
* @param {Function} fn - The function you want to eventually apply all
|
1268
1232
|
* arguments to. Invokes with (arguments...).
|
1269
1233
|
* @param {...*} arguments... - Any number of arguments to automatically apply
|
1270
1234
|
* when the continuation is called.
|
1235
|
+
* @returns {Function} the partially-applied function
|
1271
1236
|
* @example
|
1272
1237
|
*
|
1273
1238
|
* // using apply
|
@@ -1296,11 +1261,13 @@ var applyEachSeries = applyEach$1(mapSeries);
|
|
1296
1261
|
* two
|
1297
1262
|
* three
|
1298
1263
|
*/
|
1299
|
-
var apply
|
1300
|
-
|
1264
|
+
var apply = function(fn/*, ...args*/) {
|
1265
|
+
var args = slice(arguments, 1);
|
1266
|
+
return function(/*callArgs*/) {
|
1267
|
+
var callArgs = slice(arguments);
|
1301
1268
|
return fn.apply(null, args.concat(callArgs));
|
1302
|
-
}
|
1303
|
-
}
|
1269
|
+
};
|
1270
|
+
};
|
1304
1271
|
|
1305
1272
|
/**
|
1306
1273
|
* A specialized version of `_.forEach` for arrays without support for
|
@@ -1570,7 +1537,10 @@ var auto = function (tasks, concurrency, callback) {
|
|
1570
1537
|
|
1571
1538
|
arrayEach(dependencies, function (dependencyName) {
|
1572
1539
|
if (!tasks[dependencyName]) {
|
1573
|
-
throw new Error('async.auto task `' + key +
|
1540
|
+
throw new Error('async.auto task `' + key +
|
1541
|
+
'` has a non-existent dependency `' +
|
1542
|
+
dependencyName + '` in ' +
|
1543
|
+
dependencies.join(', '));
|
1574
1544
|
}
|
1575
1545
|
addListener(dependencyName, function () {
|
1576
1546
|
remainingDependencies--;
|
@@ -1594,10 +1564,11 @@ var auto = function (tasks, concurrency, callback) {
|
|
1594
1564
|
if (readyTasks.length === 0 && runningTasks === 0) {
|
1595
1565
|
return callback(null, results);
|
1596
1566
|
}
|
1597
|
-
while
|
1567
|
+
while(readyTasks.length && runningTasks < concurrency) {
|
1598
1568
|
var run = readyTasks.shift();
|
1599
1569
|
run();
|
1600
1570
|
}
|
1571
|
+
|
1601
1572
|
}
|
1602
1573
|
|
1603
1574
|
function addListener(taskName, fn) {
|
@@ -1617,32 +1588,33 @@ var auto = function (tasks, concurrency, callback) {
|
|
1617
1588
|
processQueue();
|
1618
1589
|
}
|
1619
1590
|
|
1591
|
+
|
1620
1592
|
function runTask(key, task) {
|
1621
1593
|
if (hasError) return;
|
1622
1594
|
|
1623
|
-
var taskCallback = onlyOnce(
|
1595
|
+
var taskCallback = onlyOnce(function(err, result) {
|
1624
1596
|
runningTasks--;
|
1625
|
-
if (
|
1626
|
-
|
1597
|
+
if (arguments.length > 2) {
|
1598
|
+
result = slice(arguments, 1);
|
1627
1599
|
}
|
1628
1600
|
if (err) {
|
1629
1601
|
var safeResults = {};
|
1630
|
-
baseForOwn(results, function
|
1602
|
+
baseForOwn(results, function(val, rkey) {
|
1631
1603
|
safeResults[rkey] = val;
|
1632
1604
|
});
|
1633
|
-
safeResults[key] =
|
1605
|
+
safeResults[key] = result;
|
1634
1606
|
hasError = true;
|
1635
1607
|
listeners = Object.create(null);
|
1636
1608
|
|
1637
1609
|
callback(err, safeResults);
|
1638
1610
|
} else {
|
1639
|
-
results[key] =
|
1611
|
+
results[key] = result;
|
1640
1612
|
taskComplete(key);
|
1641
1613
|
}
|
1642
|
-
})
|
1614
|
+
});
|
1643
1615
|
|
1644
1616
|
runningTasks++;
|
1645
|
-
var taskFn = wrapAsync
|
1617
|
+
var taskFn = wrapAsync(task[task.length - 1]);
|
1646
1618
|
if (task.length > 1) {
|
1647
1619
|
taskFn(results, taskCallback);
|
1648
1620
|
} else {
|
@@ -1667,7 +1639,9 @@ var auto = function (tasks, concurrency, callback) {
|
|
1667
1639
|
}
|
1668
1640
|
|
1669
1641
|
if (counter !== numTasks) {
|
1670
|
-
throw new Error(
|
1642
|
+
throw new Error(
|
1643
|
+
'async.auto cannot execute tasks due to a recursive dependency'
|
1644
|
+
);
|
1671
1645
|
}
|
1672
1646
|
}
|
1673
1647
|
|
@@ -1995,7 +1969,7 @@ function parseParams(func) {
|
|
1995
1969
|
func = func.toString().replace(STRIP_COMMENTS, '');
|
1996
1970
|
func = func.match(FN_ARGS)[2].replace(' ', '');
|
1997
1971
|
func = func ? func.split(FN_ARG_SPLIT) : [];
|
1998
|
-
func = func.map(function (arg)
|
1972
|
+
func = func.map(function (arg){
|
1999
1973
|
return trim(arg.replace(FN_ARG, ''));
|
2000
1974
|
});
|
2001
1975
|
return func;
|
@@ -2089,7 +2063,9 @@ function autoInject(tasks, callback) {
|
|
2089
2063
|
baseForOwn(tasks, function (taskFn, key) {
|
2090
2064
|
var params;
|
2091
2065
|
var fnIsAsync = isAsync(taskFn);
|
2092
|
-
var hasNoDeps =
|
2066
|
+
var hasNoDeps =
|
2067
|
+
(!fnIsAsync && taskFn.length === 1) ||
|
2068
|
+
(fnIsAsync && taskFn.length === 0);
|
2093
2069
|
|
2094
2070
|
if (isArray(taskFn)) {
|
2095
2071
|
params = taskFn.slice(0, -1);
|
@@ -2116,40 +2092,13 @@ function autoInject(tasks, callback) {
|
|
2116
2092
|
return results[name];
|
2117
2093
|
});
|
2118
2094
|
newArgs.push(taskCb);
|
2119
|
-
wrapAsync
|
2095
|
+
wrapAsync(taskFn).apply(null, newArgs);
|
2120
2096
|
}
|
2121
2097
|
});
|
2122
2098
|
|
2123
2099
|
auto(newTasks, callback);
|
2124
2100
|
}
|
2125
2101
|
|
2126
|
-
var hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
|
2127
|
-
var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';
|
2128
|
-
|
2129
|
-
function fallback(fn) {
|
2130
|
-
setTimeout(fn, 0);
|
2131
|
-
}
|
2132
|
-
|
2133
|
-
function wrap(defer) {
|
2134
|
-
return rest(function (fn, args) {
|
2135
|
-
defer(function () {
|
2136
|
-
fn.apply(null, args);
|
2137
|
-
});
|
2138
|
-
});
|
2139
|
-
}
|
2140
|
-
|
2141
|
-
var _defer;
|
2142
|
-
|
2143
|
-
if (hasSetImmediate) {
|
2144
|
-
_defer = setImmediate;
|
2145
|
-
} else if (hasNextTick) {
|
2146
|
-
_defer = process.nextTick;
|
2147
|
-
} else {
|
2148
|
-
_defer = fallback;
|
2149
|
-
}
|
2150
|
-
|
2151
|
-
var setImmediate$1 = wrap(_defer);
|
2152
|
-
|
2153
2102
|
// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation
|
2154
2103
|
// used for queues. This implementation assumes that the node provided by the user can be modified
|
2155
2104
|
// to adjust the next and last properties. We implement only the minimal functionality
|
@@ -2164,57 +2113,89 @@ function setInitial(dll, node) {
|
|
2164
2113
|
dll.head = dll.tail = node;
|
2165
2114
|
}
|
2166
2115
|
|
2167
|
-
DLL.prototype.removeLink = function
|
2168
|
-
if (node.prev) node.prev.next = node.next;
|
2169
|
-
|
2116
|
+
DLL.prototype.removeLink = function(node) {
|
2117
|
+
if (node.prev) node.prev.next = node.next;
|
2118
|
+
else this.head = node.next;
|
2119
|
+
if (node.next) node.next.prev = node.prev;
|
2120
|
+
else this.tail = node.prev;
|
2170
2121
|
|
2171
2122
|
node.prev = node.next = null;
|
2172
2123
|
this.length -= 1;
|
2173
2124
|
return node;
|
2174
2125
|
};
|
2175
2126
|
|
2176
|
-
DLL.prototype.empty =
|
2127
|
+
DLL.prototype.empty = function () {
|
2128
|
+
while(this.head) this.shift();
|
2129
|
+
return this;
|
2130
|
+
};
|
2177
2131
|
|
2178
|
-
DLL.prototype.insertAfter = function
|
2132
|
+
DLL.prototype.insertAfter = function(node, newNode) {
|
2179
2133
|
newNode.prev = node;
|
2180
2134
|
newNode.next = node.next;
|
2181
|
-
if (node.next) node.next.prev = newNode;
|
2135
|
+
if (node.next) node.next.prev = newNode;
|
2136
|
+
else this.tail = newNode;
|
2182
2137
|
node.next = newNode;
|
2183
2138
|
this.length += 1;
|
2184
2139
|
};
|
2185
2140
|
|
2186
|
-
DLL.prototype.insertBefore = function
|
2141
|
+
DLL.prototype.insertBefore = function(node, newNode) {
|
2187
2142
|
newNode.prev = node.prev;
|
2188
2143
|
newNode.next = node;
|
2189
|
-
if (node.prev) node.prev.next = newNode;
|
2144
|
+
if (node.prev) node.prev.next = newNode;
|
2145
|
+
else this.head = newNode;
|
2190
2146
|
node.prev = newNode;
|
2191
2147
|
this.length += 1;
|
2192
2148
|
};
|
2193
2149
|
|
2194
|
-
DLL.prototype.unshift = function
|
2195
|
-
if (this.head) this.insertBefore(this.head, node);
|
2150
|
+
DLL.prototype.unshift = function(node) {
|
2151
|
+
if (this.head) this.insertBefore(this.head, node);
|
2152
|
+
else setInitial(this, node);
|
2196
2153
|
};
|
2197
2154
|
|
2198
|
-
DLL.prototype.push = function
|
2199
|
-
if (this.tail) this.insertAfter(this.tail, node);
|
2155
|
+
DLL.prototype.push = function(node) {
|
2156
|
+
if (this.tail) this.insertAfter(this.tail, node);
|
2157
|
+
else setInitial(this, node);
|
2200
2158
|
};
|
2201
2159
|
|
2202
|
-
DLL.prototype.shift = function
|
2160
|
+
DLL.prototype.shift = function() {
|
2203
2161
|
return this.head && this.removeLink(this.head);
|
2204
2162
|
};
|
2205
2163
|
|
2206
|
-
DLL.prototype.pop = function
|
2164
|
+
DLL.prototype.pop = function() {
|
2207
2165
|
return this.tail && this.removeLink(this.tail);
|
2208
2166
|
};
|
2209
2167
|
|
2168
|
+
DLL.prototype.toArray = function () {
|
2169
|
+
var arr = Array(this.length);
|
2170
|
+
var curr = this.head;
|
2171
|
+
for(var idx = 0; idx < this.length; idx++) {
|
2172
|
+
arr[idx] = curr.data;
|
2173
|
+
curr = curr.next;
|
2174
|
+
}
|
2175
|
+
return arr;
|
2176
|
+
};
|
2177
|
+
|
2178
|
+
DLL.prototype.remove = function (testFn) {
|
2179
|
+
var curr = this.head;
|
2180
|
+
while(!!curr) {
|
2181
|
+
var next = curr.next;
|
2182
|
+
if (testFn(curr)) {
|
2183
|
+
this.removeLink(curr);
|
2184
|
+
}
|
2185
|
+
curr = next;
|
2186
|
+
}
|
2187
|
+
return this;
|
2188
|
+
};
|
2189
|
+
|
2210
2190
|
function queue(worker, concurrency, payload) {
|
2211
2191
|
if (concurrency == null) {
|
2212
2192
|
concurrency = 1;
|
2213
|
-
}
|
2193
|
+
}
|
2194
|
+
else if(concurrency === 0) {
|
2214
2195
|
throw new Error('Concurrency must not be zero');
|
2215
2196
|
}
|
2216
2197
|
|
2217
|
-
var _worker = wrapAsync
|
2198
|
+
var _worker = wrapAsync(worker);
|
2218
2199
|
var numRunning = 0;
|
2219
2200
|
var workersList = [];
|
2220
2201
|
|
@@ -2228,7 +2209,7 @@ function queue(worker, concurrency, payload) {
|
|
2228
2209
|
}
|
2229
2210
|
if (data.length === 0 && q.idle()) {
|
2230
2211
|
// call drain immediately if there are no tasks
|
2231
|
-
return setImmediate$1(function
|
2212
|
+
return setImmediate$1(function() {
|
2232
2213
|
q.drain();
|
2233
2214
|
});
|
2234
2215
|
}
|
@@ -2249,7 +2230,7 @@ function queue(worker, concurrency, payload) {
|
|
2249
2230
|
}
|
2250
2231
|
|
2251
2232
|
function _next(tasks) {
|
2252
|
-
return
|
2233
|
+
return function(err){
|
2253
2234
|
numRunning -= 1;
|
2254
2235
|
|
2255
2236
|
for (var i = 0, l = tasks.length; i < l; i++) {
|
@@ -2259,14 +2240,14 @@ function queue(worker, concurrency, payload) {
|
|
2259
2240
|
workersList.splice(index);
|
2260
2241
|
}
|
2261
2242
|
|
2262
|
-
task.callback.apply(task,
|
2243
|
+
task.callback.apply(task, arguments);
|
2263
2244
|
|
2264
|
-
if (
|
2265
|
-
q.error(
|
2245
|
+
if (err != null) {
|
2246
|
+
q.error(err, task.data);
|
2266
2247
|
}
|
2267
2248
|
}
|
2268
2249
|
|
2269
|
-
if (numRunning <= q.concurrency - q.buffer) {
|
2250
|
+
if (numRunning <= (q.concurrency - q.buffer) ) {
|
2270
2251
|
q.unsaturated();
|
2271
2252
|
}
|
2272
2253
|
|
@@ -2274,7 +2255,7 @@ function queue(worker, concurrency, payload) {
|
|
2274
2255
|
q.drain();
|
2275
2256
|
}
|
2276
2257
|
q.process();
|
2277
|
-
}
|
2258
|
+
};
|
2278
2259
|
}
|
2279
2260
|
|
2280
2261
|
var isProcessing = false;
|
@@ -2283,7 +2264,7 @@ function queue(worker, concurrency, payload) {
|
|
2283
2264
|
concurrency: concurrency,
|
2284
2265
|
payload: payload,
|
2285
2266
|
saturated: noop,
|
2286
|
-
unsaturated:
|
2267
|
+
unsaturated:noop,
|
2287
2268
|
buffer: concurrency / 4,
|
2288
2269
|
empty: noop,
|
2289
2270
|
drain: noop,
|
@@ -2300,6 +2281,9 @@ function queue(worker, concurrency, payload) {
|
|
2300
2281
|
unshift: function (data, callback) {
|
2301
2282
|
_insert(data, true, callback);
|
2302
2283
|
},
|
2284
|
+
remove: function (testFn) {
|
2285
|
+
q._tasks.remove(testFn);
|
2286
|
+
},
|
2303
2287
|
process: function () {
|
2304
2288
|
// Avoid trying to start too many processing operations. This can occur
|
2305
2289
|
// when callbacks resolve synchronously (#1267).
|
@@ -2307,9 +2291,8 @@ function queue(worker, concurrency, payload) {
|
|
2307
2291
|
return;
|
2308
2292
|
}
|
2309
2293
|
isProcessing = true;
|
2310
|
-
while
|
2311
|
-
var tasks = [],
|
2312
|
-
data = [];
|
2294
|
+
while(!q.paused && numRunning < q.concurrency && q._tasks.length){
|
2295
|
+
var tasks = [], data = [];
|
2313
2296
|
var l = q._tasks.length;
|
2314
2297
|
if (q.payload) l = Math.min(l, q.payload);
|
2315
2298
|
for (var i = 0; i < l; i++) {
|
@@ -2318,11 +2301,12 @@ function queue(worker, concurrency, payload) {
|
|
2318
2301
|
data.push(node.data);
|
2319
2302
|
}
|
2320
2303
|
|
2304
|
+
numRunning += 1;
|
2305
|
+
workersList.push(tasks[0]);
|
2306
|
+
|
2321
2307
|
if (q._tasks.length === 0) {
|
2322
2308
|
q.empty();
|
2323
2309
|
}
|
2324
|
-
numRunning += 1;
|
2325
|
-
workersList.push(tasks[0]);
|
2326
2310
|
|
2327
2311
|
if (numRunning === q.concurrency) {
|
2328
2312
|
q.saturated();
|
@@ -2342,16 +2326,14 @@ function queue(worker, concurrency, payload) {
|
|
2342
2326
|
workersList: function () {
|
2343
2327
|
return workersList;
|
2344
2328
|
},
|
2345
|
-
idle: function
|
2329
|
+
idle: function() {
|
2346
2330
|
return q._tasks.length + numRunning === 0;
|
2347
2331
|
},
|
2348
2332
|
pause: function () {
|
2349
2333
|
q.paused = true;
|
2350
2334
|
},
|
2351
2335
|
resume: function () {
|
2352
|
-
if (q.paused === false) {
|
2353
|
-
return;
|
2354
|
-
}
|
2336
|
+
if (q.paused === false) { return; }
|
2355
2337
|
q.paused = false;
|
2356
2338
|
setImmediate$1(q.process);
|
2357
2339
|
}
|
@@ -2437,7 +2419,7 @@ function queue(worker, concurrency, payload) {
|
|
2437
2419
|
* });
|
2438
2420
|
*/
|
2439
2421
|
function cargo(worker, payload) {
|
2440
|
-
|
2422
|
+
return queue(worker, 1, payload);
|
2441
2423
|
}
|
2442
2424
|
|
2443
2425
|
/**
|
@@ -2501,13 +2483,13 @@ var eachOfSeries = doLimit(eachOfLimit, 1);
|
|
2501
2483
|
*/
|
2502
2484
|
function reduce(coll, memo, iteratee, callback) {
|
2503
2485
|
callback = once(callback || noop);
|
2504
|
-
var _iteratee = wrapAsync
|
2505
|
-
eachOfSeries(coll, function
|
2506
|
-
_iteratee(memo, x, function
|
2486
|
+
var _iteratee = wrapAsync(iteratee);
|
2487
|
+
eachOfSeries(coll, function(x, i, callback) {
|
2488
|
+
_iteratee(memo, x, function(err, v) {
|
2507
2489
|
memo = v;
|
2508
2490
|
callback(err);
|
2509
2491
|
});
|
2510
|
-
}, function
|
2492
|
+
}, function(err) {
|
2511
2493
|
callback(err, memo);
|
2512
2494
|
});
|
2513
2495
|
}
|
@@ -2550,9 +2532,10 @@ function reduce(coll, memo, iteratee, callback) {
|
|
2550
2532
|
* });
|
2551
2533
|
* });
|
2552
2534
|
*/
|
2553
|
-
|
2554
|
-
var _functions = arrayMap(
|
2555
|
-
return
|
2535
|
+
function seq(/*...functions*/) {
|
2536
|
+
var _functions = arrayMap(arguments, wrapAsync);
|
2537
|
+
return function(/*...args*/) {
|
2538
|
+
var args = slice(arguments);
|
2556
2539
|
var that = this;
|
2557
2540
|
|
2558
2541
|
var cb = args[args.length - 1];
|
@@ -2562,15 +2545,17 @@ var seq$1 = rest(function seq(functions) {
|
|
2562
2545
|
cb = noop;
|
2563
2546
|
}
|
2564
2547
|
|
2565
|
-
reduce(_functions, args, function
|
2566
|
-
fn.apply(that, newargs.concat(
|
2548
|
+
reduce(_functions, args, function(newargs, fn, cb) {
|
2549
|
+
fn.apply(that, newargs.concat(function(err/*, ...nextargs*/) {
|
2550
|
+
var nextargs = slice(arguments, 1);
|
2567
2551
|
cb(err, nextargs);
|
2568
|
-
}))
|
2569
|
-
},
|
2552
|
+
}));
|
2553
|
+
},
|
2554
|
+
function(err, results) {
|
2570
2555
|
cb.apply(that, [err].concat(results));
|
2571
2556
|
});
|
2572
|
-
}
|
2573
|
-
}
|
2557
|
+
};
|
2558
|
+
}
|
2574
2559
|
|
2575
2560
|
/**
|
2576
2561
|
* Creates a function which is a composition of the passed asynchronous
|
@@ -2607,9 +2592,9 @@ var seq$1 = rest(function seq(functions) {
|
|
2607
2592
|
* // result now equals 15
|
2608
2593
|
* });
|
2609
2594
|
*/
|
2610
|
-
var compose =
|
2611
|
-
|
2612
|
-
}
|
2595
|
+
var compose = function(/*...args*/) {
|
2596
|
+
return seq.apply(null, slice(arguments).reverse());
|
2597
|
+
};
|
2613
2598
|
|
2614
2599
|
function concat$1(eachfn, arr, fn, callback) {
|
2615
2600
|
var result = [];
|
@@ -2652,7 +2637,7 @@ var concat = doParallel(concat$1);
|
|
2652
2637
|
|
2653
2638
|
function doSeries(fn) {
|
2654
2639
|
return function (obj, iteratee, callback) {
|
2655
|
-
return fn(eachOfSeries, obj, wrapAsync
|
2640
|
+
return fn(eachOfSeries, obj, wrapAsync(iteratee), callback);
|
2656
2641
|
};
|
2657
2642
|
}
|
2658
2643
|
|
@@ -2718,20 +2703,42 @@ var concatSeries = doSeries(concat$1);
|
|
2718
2703
|
* //...
|
2719
2704
|
* }, callback);
|
2720
2705
|
*/
|
2721
|
-
var constant =
|
2706
|
+
var constant = function(/*...values*/) {
|
2707
|
+
var values = slice(arguments);
|
2722
2708
|
var args = [null].concat(values);
|
2723
|
-
return
|
2709
|
+
return function (/*...ignoredArgs, callback*/) {
|
2710
|
+
var callback = arguments[arguments.length - 1];
|
2724
2711
|
return callback.apply(this, args);
|
2725
|
-
}
|
2726
|
-
}
|
2712
|
+
};
|
2713
|
+
};
|
2714
|
+
|
2715
|
+
/**
|
2716
|
+
* This method returns the first argument it receives.
|
2717
|
+
*
|
2718
|
+
* @static
|
2719
|
+
* @since 0.1.0
|
2720
|
+
* @memberOf _
|
2721
|
+
* @category Util
|
2722
|
+
* @param {*} value Any value.
|
2723
|
+
* @returns {*} Returns `value`.
|
2724
|
+
* @example
|
2725
|
+
*
|
2726
|
+
* var object = { 'a': 1 };
|
2727
|
+
*
|
2728
|
+
* console.log(_.identity(object) === object);
|
2729
|
+
* // => true
|
2730
|
+
*/
|
2731
|
+
function identity(value) {
|
2732
|
+
return value;
|
2733
|
+
}
|
2727
2734
|
|
2728
2735
|
function _createTester(check, getResult) {
|
2729
|
-
return function
|
2736
|
+
return function(eachfn, arr, iteratee, cb) {
|
2730
2737
|
cb = cb || noop;
|
2731
2738
|
var testPassed = false;
|
2732
2739
|
var testResult;
|
2733
|
-
eachfn(arr, function
|
2734
|
-
iteratee(value, function
|
2740
|
+
eachfn(arr, function(value, _, callback) {
|
2741
|
+
iteratee(value, function(err, result) {
|
2735
2742
|
if (err) {
|
2736
2743
|
callback(err);
|
2737
2744
|
} else if (check(result) && !testResult) {
|
@@ -2742,7 +2749,7 @@ function _createTester(check, getResult) {
|
|
2742
2749
|
callback();
|
2743
2750
|
}
|
2744
2751
|
});
|
2745
|
-
}, function
|
2752
|
+
}, function(err) {
|
2746
2753
|
if (err) {
|
2747
2754
|
cb(err);
|
2748
2755
|
} else {
|
@@ -2840,8 +2847,10 @@ var detectLimit = doParallelLimit(_createTester(identity, _findGetResult));
|
|
2840
2847
|
var detectSeries = doLimit(detectLimit, 1);
|
2841
2848
|
|
2842
2849
|
function consoleFunc(name) {
|
2843
|
-
return
|
2844
|
-
|
2850
|
+
return function (fn/*, ...args*/) {
|
2851
|
+
var args = slice(arguments, 1);
|
2852
|
+
args.push(function (err/*, ...args*/) {
|
2853
|
+
var args = slice(arguments, 1);
|
2845
2854
|
if (typeof console === 'object') {
|
2846
2855
|
if (err) {
|
2847
2856
|
if (console.error) {
|
@@ -2853,8 +2862,9 @@ function consoleFunc(name) {
|
|
2853
2862
|
});
|
2854
2863
|
}
|
2855
2864
|
}
|
2856
|
-
})
|
2857
|
-
|
2865
|
+
});
|
2866
|
+
wrapAsync(fn).apply(null, args);
|
2867
|
+
};
|
2858
2868
|
}
|
2859
2869
|
|
2860
2870
|
/**
|
@@ -2910,14 +2920,15 @@ var dir = consoleFunc('dir');
|
|
2910
2920
|
*/
|
2911
2921
|
function doDuring(fn, test, callback) {
|
2912
2922
|
callback = onlyOnce(callback || noop);
|
2913
|
-
var _fn = wrapAsync
|
2914
|
-
var _test = wrapAsync
|
2923
|
+
var _fn = wrapAsync(fn);
|
2924
|
+
var _test = wrapAsync(test);
|
2915
2925
|
|
2916
|
-
|
2926
|
+
function next(err/*, ...args*/) {
|
2917
2927
|
if (err) return callback(err);
|
2928
|
+
var args = slice(arguments, 1);
|
2918
2929
|
args.push(check);
|
2919
2930
|
_test.apply(this, args);
|
2920
|
-
}
|
2931
|
+
}
|
2921
2932
|
|
2922
2933
|
function check(err, truth) {
|
2923
2934
|
if (err) return callback(err);
|
@@ -2926,6 +2937,7 @@ function doDuring(fn, test, callback) {
|
|
2926
2937
|
}
|
2927
2938
|
|
2928
2939
|
check(null, true);
|
2940
|
+
|
2929
2941
|
}
|
2930
2942
|
|
2931
2943
|
/**
|
@@ -2952,12 +2964,13 @@ function doDuring(fn, test, callback) {
|
|
2952
2964
|
*/
|
2953
2965
|
function doWhilst(iteratee, test, callback) {
|
2954
2966
|
callback = onlyOnce(callback || noop);
|
2955
|
-
var _iteratee = wrapAsync
|
2956
|
-
var next =
|
2967
|
+
var _iteratee = wrapAsync(iteratee);
|
2968
|
+
var next = function(err/*, ...args*/) {
|
2957
2969
|
if (err) return callback(err);
|
2970
|
+
var args = slice(arguments, 1);
|
2958
2971
|
if (test.apply(this, args)) return _iteratee(next);
|
2959
2972
|
callback.apply(null, [null].concat(args));
|
2960
|
-
}
|
2973
|
+
};
|
2961
2974
|
_iteratee(next);
|
2962
2975
|
}
|
2963
2976
|
|
@@ -2982,7 +2995,7 @@ function doWhilst(iteratee, test, callback) {
|
|
2982
2995
|
* callback. Invoked with (err, [results]);
|
2983
2996
|
*/
|
2984
2997
|
function doUntil(iteratee, test, callback) {
|
2985
|
-
doWhilst(iteratee, function
|
2998
|
+
doWhilst(iteratee, function() {
|
2986
2999
|
return !test.apply(this, arguments);
|
2987
3000
|
}, callback);
|
2988
3001
|
}
|
@@ -3025,8 +3038,8 @@ function doUntil(iteratee, test, callback) {
|
|
3025
3038
|
*/
|
3026
3039
|
function during(test, fn, callback) {
|
3027
3040
|
callback = onlyOnce(callback || noop);
|
3028
|
-
var _fn = wrapAsync
|
3029
|
-
var _test = wrapAsync
|
3041
|
+
var _fn = wrapAsync(fn);
|
3042
|
+
var _test = wrapAsync(test);
|
3030
3043
|
|
3031
3044
|
function next(err) {
|
3032
3045
|
if (err) return callback(err);
|
@@ -3106,7 +3119,7 @@ function _withoutIndex(iteratee) {
|
|
3106
3119
|
* });
|
3107
3120
|
*/
|
3108
3121
|
function eachLimit(coll, iteratee, callback) {
|
3109
|
-
|
3122
|
+
eachOf(coll, _withoutIndex(wrapAsync(iteratee)), callback);
|
3110
3123
|
}
|
3111
3124
|
|
3112
3125
|
/**
|
@@ -3130,7 +3143,7 @@ function eachLimit(coll, iteratee, callback) {
|
|
3130
3143
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
3131
3144
|
*/
|
3132
3145
|
function eachLimit$1(coll, limit, iteratee, callback) {
|
3133
|
-
|
3146
|
+
_eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);
|
3134
3147
|
}
|
3135
3148
|
|
3136
3149
|
/**
|
@@ -3323,7 +3336,7 @@ function filterGeneric(eachfn, coll, iteratee, callback) {
|
|
3323
3336
|
callback(err);
|
3324
3337
|
} else {
|
3325
3338
|
if (v) {
|
3326
|
-
results.push({
|
3339
|
+
results.push({index: index, value: x});
|
3327
3340
|
}
|
3328
3341
|
callback();
|
3329
3342
|
}
|
@@ -3341,7 +3354,7 @@ function filterGeneric(eachfn, coll, iteratee, callback) {
|
|
3341
3354
|
|
3342
3355
|
function _filter(eachfn, coll, iteratee, callback) {
|
3343
3356
|
var filter = isArrayLike(coll) ? filterArray : filterGeneric;
|
3344
|
-
filter(eachfn, coll, wrapAsync
|
3357
|
+
filter(eachfn, coll, wrapAsync(iteratee), callback || noop);
|
3345
3358
|
}
|
3346
3359
|
|
3347
3360
|
/**
|
@@ -3444,7 +3457,7 @@ var filterSeries = doLimit(filterLimit, 1);
|
|
3444
3457
|
*/
|
3445
3458
|
function forever(fn, errback) {
|
3446
3459
|
var done = onlyOnce(errback || noop);
|
3447
|
-
var task = wrapAsync
|
3460
|
+
var task = wrapAsync(ensureAsync(fn));
|
3448
3461
|
|
3449
3462
|
function next(err) {
|
3450
3463
|
if (err) return done(err);
|
@@ -3472,15 +3485,15 @@ function forever(fn, errback) {
|
|
3472
3485
|
* functions have finished, or an error occurs. Result is an `Object` whoses
|
3473
3486
|
* properties are arrays of values which returned the corresponding key.
|
3474
3487
|
*/
|
3475
|
-
var groupByLimit = function
|
3488
|
+
var groupByLimit = function(coll, limit, iteratee, callback) {
|
3476
3489
|
callback = callback || noop;
|
3477
|
-
var _iteratee = wrapAsync
|
3478
|
-
mapLimit(coll, limit, function
|
3479
|
-
_iteratee(val, function
|
3490
|
+
var _iteratee = wrapAsync(iteratee);
|
3491
|
+
mapLimit(coll, limit, function(val, callback) {
|
3492
|
+
_iteratee(val, function(err, key) {
|
3480
3493
|
if (err) return callback(err);
|
3481
|
-
return callback(null, {
|
3494
|
+
return callback(null, {key: key, val: val});
|
3482
3495
|
});
|
3483
|
-
}, function
|
3496
|
+
}, function(err, mapResults) {
|
3484
3497
|
var result = {};
|
3485
3498
|
// from MDN, handle object having an `hasOwnProperty` prop
|
3486
3499
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
@@ -3614,8 +3627,8 @@ var log = consoleFunc('log');
|
|
3614
3627
|
function mapValuesLimit(obj, limit, iteratee, callback) {
|
3615
3628
|
callback = once(callback || noop);
|
3616
3629
|
var newObj = {};
|
3617
|
-
var _iteratee = wrapAsync
|
3618
|
-
eachOfLimit(obj, limit, function
|
3630
|
+
var _iteratee = wrapAsync(iteratee);
|
3631
|
+
eachOfLimit(obj, limit, function(val, key, next) {
|
3619
3632
|
_iteratee(val, key, function (err, result) {
|
3620
3633
|
if (err) return next(err);
|
3621
3634
|
newObj[key] = result;
|
@@ -3739,25 +3752,26 @@ function memoize(fn, hasher) {
|
|
3739
3752
|
var memo = Object.create(null);
|
3740
3753
|
var queues = Object.create(null);
|
3741
3754
|
hasher = hasher || identity;
|
3742
|
-
var _fn = wrapAsync
|
3755
|
+
var _fn = wrapAsync(fn);
|
3743
3756
|
var memoized = initialParams(function memoized(args, callback) {
|
3744
3757
|
var key = hasher.apply(null, args);
|
3745
3758
|
if (has(memo, key)) {
|
3746
|
-
setImmediate$1(function
|
3759
|
+
setImmediate$1(function() {
|
3747
3760
|
callback.apply(null, memo[key]);
|
3748
3761
|
});
|
3749
3762
|
} else if (has(queues, key)) {
|
3750
3763
|
queues[key].push(callback);
|
3751
3764
|
} else {
|
3752
3765
|
queues[key] = [callback];
|
3753
|
-
_fn.apply(null, args.concat(
|
3766
|
+
_fn.apply(null, args.concat(function(/*args*/) {
|
3767
|
+
var args = slice(arguments);
|
3754
3768
|
memo[key] = args;
|
3755
3769
|
var q = queues[key];
|
3756
3770
|
delete queues[key];
|
3757
3771
|
for (var i = 0, l = q.length; i < l; i++) {
|
3758
3772
|
q[i].apply(null, args);
|
3759
3773
|
}
|
3760
|
-
}))
|
3774
|
+
}));
|
3761
3775
|
}
|
3762
3776
|
});
|
3763
3777
|
memoized.memo = memo;
|
@@ -3813,13 +3827,13 @@ function _parallel(eachfn, tasks, callback) {
|
|
3813
3827
|
var results = isArrayLike(tasks) ? [] : {};
|
3814
3828
|
|
3815
3829
|
eachfn(tasks, function (task, key, callback) {
|
3816
|
-
wrapAsync
|
3817
|
-
if (
|
3818
|
-
|
3830
|
+
wrapAsync(task)(function (err, result) {
|
3831
|
+
if (arguments.length > 2) {
|
3832
|
+
result = slice(arguments, 1);
|
3819
3833
|
}
|
3820
|
-
results[key] =
|
3834
|
+
results[key] = result;
|
3821
3835
|
callback(err);
|
3822
|
-
})
|
3836
|
+
});
|
3823
3837
|
}, function (err) {
|
3824
3838
|
callback(err, results);
|
3825
3839
|
});
|
@@ -3895,7 +3909,7 @@ function _parallel(eachfn, tasks, callback) {
|
|
3895
3909
|
* });
|
3896
3910
|
*/
|
3897
3911
|
function parallelLimit(tasks, callback) {
|
3898
|
-
|
3912
|
+
_parallel(eachOf, tasks, callback);
|
3899
3913
|
}
|
3900
3914
|
|
3901
3915
|
/**
|
@@ -3918,7 +3932,7 @@ function parallelLimit(tasks, callback) {
|
|
3918
3932
|
* Invoked with (err, results).
|
3919
3933
|
*/
|
3920
3934
|
function parallelLimit$1(tasks, limit, callback) {
|
3921
|
-
|
3935
|
+
_parallel(_eachOfLimit(limit), tasks, callback);
|
3922
3936
|
}
|
3923
3937
|
|
3924
3938
|
/**
|
@@ -3944,6 +3958,12 @@ function parallelLimit$1(tasks, limit, callback) {
|
|
3944
3958
|
* task in the list. Invoke with `queue.push(task, [callback])`,
|
3945
3959
|
* @property {Function} unshift - add a new task to the front of the `queue`.
|
3946
3960
|
* Invoke with `queue.unshift(task, [callback])`.
|
3961
|
+
* @property {Function} remove - remove items from the queue that match a test
|
3962
|
+
* function. The test function will be passed an object with a `data` property,
|
3963
|
+
* and a `priority` property, if this is a
|
3964
|
+
* [priorityQueue]{@link module:ControlFlow.priorityQueue} object.
|
3965
|
+
* Invoked with `queue.remove(testFn)`, where `testFn` is of the form
|
3966
|
+
* `function ({data, priority}) {}` and returns a Boolean.
|
3947
3967
|
* @property {Function} saturated - a callback that is called when the number of
|
3948
3968
|
* running workers hits the `concurrency` limit, and further tasks will be
|
3949
3969
|
* queued.
|
@@ -4020,10 +4040,10 @@ function parallelLimit$1(tasks, limit, callback) {
|
|
4020
4040
|
* });
|
4021
4041
|
*/
|
4022
4042
|
var queue$1 = function (worker, concurrency) {
|
4023
|
-
|
4024
|
-
|
4025
|
-
|
4026
|
-
|
4043
|
+
var _worker = wrapAsync(worker);
|
4044
|
+
return queue(function (items, cb) {
|
4045
|
+
_worker(items[0], cb);
|
4046
|
+
}, concurrency, 1);
|
4027
4047
|
};
|
4028
4048
|
|
4029
4049
|
/**
|
@@ -4049,12 +4069,12 @@ var queue$1 = function (worker, concurrency) {
|
|
4049
4069
|
* array of `tasks` is given, all tasks will be assigned the same priority.
|
4050
4070
|
* * The `unshift` method was removed.
|
4051
4071
|
*/
|
4052
|
-
var priorityQueue = function
|
4072
|
+
var priorityQueue = function(worker, concurrency) {
|
4053
4073
|
// Start with a normal queue
|
4054
4074
|
var q = queue$1(worker, concurrency);
|
4055
4075
|
|
4056
4076
|
// Override push to accept second parameter representing priority
|
4057
|
-
q.push = function
|
4077
|
+
q.push = function(data, priority, callback) {
|
4058
4078
|
if (callback == null) callback = noop;
|
4059
4079
|
if (typeof callback !== 'function') {
|
4060
4080
|
throw new Error('task callback must be a function');
|
@@ -4065,7 +4085,7 @@ var priorityQueue = function (worker, concurrency) {
|
|
4065
4085
|
}
|
4066
4086
|
if (data.length === 0) {
|
4067
4087
|
// call drain immediately if there are no tasks
|
4068
|
-
return setImmediate$1(function
|
4088
|
+
return setImmediate$1(function() {
|
4069
4089
|
q.drain();
|
4070
4090
|
});
|
4071
4091
|
}
|
@@ -4139,12 +4159,10 @@ function race(tasks, callback) {
|
|
4139
4159
|
if (!isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions'));
|
4140
4160
|
if (!tasks.length) return callback();
|
4141
4161
|
for (var i = 0, l = tasks.length; i < l; i++) {
|
4142
|
-
wrapAsync
|
4162
|
+
wrapAsync(tasks[i])(callback);
|
4143
4163
|
}
|
4144
4164
|
}
|
4145
4165
|
|
4146
|
-
var slice = Array.prototype.slice;
|
4147
|
-
|
4148
4166
|
/**
|
4149
4167
|
* Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.
|
4150
4168
|
*
|
@@ -4167,9 +4185,9 @@ var slice = Array.prototype.slice;
|
|
4167
4185
|
* `iteratee` functions have finished. Result is the reduced value. Invoked with
|
4168
4186
|
* (err, result).
|
4169
4187
|
*/
|
4170
|
-
function reduceRight(array, memo, iteratee, callback) {
|
4171
|
-
|
4172
|
-
|
4188
|
+
function reduceRight (array, memo, iteratee, callback) {
|
4189
|
+
var reversed = slice(array).reverse();
|
4190
|
+
reduce(reversed, memo, iteratee, callback);
|
4173
4191
|
}
|
4174
4192
|
|
4175
4193
|
/**
|
@@ -4212,33 +4230,29 @@ function reduceRight(array, memo, iteratee, callback) {
|
|
4212
4230
|
* });
|
4213
4231
|
*/
|
4214
4232
|
function reflect(fn) {
|
4215
|
-
var _fn = wrapAsync
|
4233
|
+
var _fn = wrapAsync(fn);
|
4216
4234
|
return initialParams(function reflectOn(args, reflectCallback) {
|
4217
|
-
args.push(
|
4218
|
-
if (
|
4219
|
-
reflectCallback(null, {
|
4220
|
-
error: err
|
4221
|
-
});
|
4235
|
+
args.push(function callback(error, cbArg) {
|
4236
|
+
if (error) {
|
4237
|
+
reflectCallback(null, { error: error });
|
4222
4238
|
} else {
|
4223
|
-
var value
|
4224
|
-
if (
|
4225
|
-
value =
|
4226
|
-
} else
|
4227
|
-
value =
|
4239
|
+
var value;
|
4240
|
+
if (arguments.length <= 2) {
|
4241
|
+
value = cbArg;
|
4242
|
+
} else {
|
4243
|
+
value = slice(arguments, 1);
|
4228
4244
|
}
|
4229
|
-
reflectCallback(null, {
|
4230
|
-
value: value
|
4231
|
-
});
|
4245
|
+
reflectCallback(null, { value: value });
|
4232
4246
|
}
|
4233
|
-
})
|
4247
|
+
});
|
4234
4248
|
|
4235
4249
|
return _fn.apply(this, args);
|
4236
4250
|
});
|
4237
4251
|
}
|
4238
4252
|
|
4239
4253
|
function reject$1(eachfn, arr, iteratee, callback) {
|
4240
|
-
_filter(eachfn, arr, function
|
4241
|
-
iteratee(value, function
|
4254
|
+
_filter(eachfn, arr, function(value, cb) {
|
4255
|
+
iteratee(value, function(err, v) {
|
4242
4256
|
cb(err, !v);
|
4243
4257
|
});
|
4244
4258
|
}, callback);
|
@@ -4346,7 +4360,7 @@ function reflectAll(tasks) {
|
|
4346
4360
|
results = arrayMap(tasks, reflect);
|
4347
4361
|
} else {
|
4348
4362
|
results = {};
|
4349
|
-
baseForOwn(tasks, function
|
4363
|
+
baseForOwn(tasks, function(task, key) {
|
4350
4364
|
results[key] = reflect.call(this, task);
|
4351
4365
|
});
|
4352
4366
|
}
|
@@ -4515,7 +4529,9 @@ function retry(opts, task, callback) {
|
|
4515
4529
|
if (typeof t === 'object') {
|
4516
4530
|
acc.times = +t.times || DEFAULT_TIMES;
|
4517
4531
|
|
4518
|
-
acc.intervalFunc = typeof t.interval === 'function' ?
|
4532
|
+
acc.intervalFunc = typeof t.interval === 'function' ?
|
4533
|
+
t.interval :
|
4534
|
+
constant$1(+t.interval || DEFAULT_INTERVAL);
|
4519
4535
|
|
4520
4536
|
acc.errorFilter = t.errorFilter;
|
4521
4537
|
} else if (typeof t === 'number' || typeof t === 'string') {
|
@@ -4537,12 +4553,14 @@ function retry(opts, task, callback) {
|
|
4537
4553
|
throw new Error("Invalid arguments for async.retry");
|
4538
4554
|
}
|
4539
4555
|
|
4540
|
-
var _task = wrapAsync
|
4556
|
+
var _task = wrapAsync(task);
|
4541
4557
|
|
4542
4558
|
var attempt = 1;
|
4543
4559
|
function retryAttempt() {
|
4544
|
-
_task(function
|
4545
|
-
if (err && attempt++ < options.times &&
|
4560
|
+
_task(function(err) {
|
4561
|
+
if (err && attempt++ < options.times &&
|
4562
|
+
(typeof options.errorFilter != 'function' ||
|
4563
|
+
options.errorFilter(err))) {
|
4546
4564
|
setTimeout(retryAttempt, options.intervalFunc(attempt));
|
4547
4565
|
} else {
|
4548
4566
|
callback.apply(null, arguments);
|
@@ -4586,13 +4604,15 @@ var retryable = function (opts, task) {
|
|
4586
4604
|
task = opts;
|
4587
4605
|
opts = null;
|
4588
4606
|
}
|
4589
|
-
var _task = wrapAsync
|
4607
|
+
var _task = wrapAsync(task);
|
4590
4608
|
return initialParams(function (args, callback) {
|
4591
4609
|
function taskFn(cb) {
|
4592
4610
|
_task.apply(null, args.concat(cb));
|
4593
4611
|
}
|
4594
4612
|
|
4595
|
-
if (opts) retry(opts, taskFn, callback);
|
4613
|
+
if (opts) retry(opts, taskFn, callback);
|
4614
|
+
else retry(taskFn, callback);
|
4615
|
+
|
4596
4616
|
});
|
4597
4617
|
};
|
4598
4618
|
|
@@ -4661,7 +4681,7 @@ var retryable = function (opts, task) {
|
|
4661
4681
|
* });
|
4662
4682
|
*/
|
4663
4683
|
function series(tasks, callback) {
|
4664
|
-
|
4684
|
+
_parallel(eachOfSeries, tasks, callback);
|
4665
4685
|
}
|
4666
4686
|
|
4667
4687
|
/**
|
@@ -4788,12 +4808,12 @@ var someSeries = doLimit(someLimit, 1);
|
|
4788
4808
|
* // result callback
|
4789
4809
|
* });
|
4790
4810
|
*/
|
4791
|
-
function sortBy(coll, iteratee, callback) {
|
4792
|
-
var _iteratee = wrapAsync
|
4811
|
+
function sortBy (coll, iteratee, callback) {
|
4812
|
+
var _iteratee = wrapAsync(iteratee);
|
4793
4813
|
map(coll, function (x, callback) {
|
4794
4814
|
_iteratee(x, function (err, criteria) {
|
4795
4815
|
if (err) return callback(err);
|
4796
|
-
callback(null, {
|
4816
|
+
callback(null, {value: x, criteria: criteria});
|
4797
4817
|
});
|
4798
4818
|
}, function (err, results) {
|
4799
4819
|
if (err) return callback(err);
|
@@ -4801,8 +4821,7 @@ function sortBy(coll, iteratee, callback) {
|
|
4801
4821
|
});
|
4802
4822
|
|
4803
4823
|
function comparator(left, right) {
|
4804
|
-
var a = left.criteria,
|
4805
|
-
b = right.criteria;
|
4824
|
+
var a = left.criteria, b = right.criteria;
|
4806
4825
|
return a < b ? -1 : a > b ? 1 : 0;
|
4807
4826
|
}
|
4808
4827
|
}
|
@@ -4861,7 +4880,7 @@ function timeout(asyncFn, milliseconds, info) {
|
|
4861
4880
|
|
4862
4881
|
function timeoutCallback() {
|
4863
4882
|
var name = asyncFn.name || 'anonymous';
|
4864
|
-
var error
|
4883
|
+
var error = new Error('Callback function "' + name + '" timed out.');
|
4865
4884
|
error.code = 'ETIMEDOUT';
|
4866
4885
|
if (info) {
|
4867
4886
|
error.info = info;
|
@@ -4870,7 +4889,7 @@ function timeout(asyncFn, milliseconds, info) {
|
|
4870
4889
|
originalCallback(error);
|
4871
4890
|
}
|
4872
4891
|
|
4873
|
-
var fn = wrapAsync
|
4892
|
+
var fn = wrapAsync(asyncFn);
|
4874
4893
|
|
4875
4894
|
return initialParams(function (args, origCallback) {
|
4876
4895
|
originalCallback = origCallback;
|
@@ -4882,7 +4901,7 @@ function timeout(asyncFn, milliseconds, info) {
|
|
4882
4901
|
|
4883
4902
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
4884
4903
|
var nativeCeil = Math.ceil;
|
4885
|
-
var nativeMax
|
4904
|
+
var nativeMax = Math.max;
|
4886
4905
|
|
4887
4906
|
/**
|
4888
4907
|
* The base implementation of `_.range` and `_.rangeRight` which doesn't
|
@@ -4897,7 +4916,7 @@ var nativeMax$1 = Math.max;
|
|
4897
4916
|
*/
|
4898
4917
|
function baseRange(start, end, step, fromRight) {
|
4899
4918
|
var index = -1,
|
4900
|
-
length = nativeMax
|
4919
|
+
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
|
4901
4920
|
result = Array(length);
|
4902
4921
|
|
4903
4922
|
while (length--) {
|
@@ -4924,8 +4943,8 @@ function baseRange(start, end, step, fromRight) {
|
|
4924
4943
|
* @param {Function} callback - see [async.map]{@link module:Collections.map}.
|
4925
4944
|
*/
|
4926
4945
|
function timeLimit(count, limit, iteratee, callback) {
|
4927
|
-
|
4928
|
-
|
4946
|
+
var _iteratee = wrapAsync(iteratee);
|
4947
|
+
mapLimit(baseRange(0, count, 1), limit, _iteratee, callback);
|
4929
4948
|
}
|
4930
4949
|
|
4931
4950
|
/**
|
@@ -5020,22 +5039,78 @@ var timesSeries = doLimit(timeLimit, 1);
|
|
5020
5039
|
* // result is equal to {a: 2, b: 4, c: 6}
|
5021
5040
|
* })
|
5022
5041
|
*/
|
5023
|
-
function transform(coll, accumulator, iteratee, callback) {
|
5042
|
+
function transform (coll, accumulator, iteratee, callback) {
|
5024
5043
|
if (arguments.length <= 3) {
|
5025
5044
|
callback = iteratee;
|
5026
5045
|
iteratee = accumulator;
|
5027
5046
|
accumulator = isArray(coll) ? [] : {};
|
5028
5047
|
}
|
5029
5048
|
callback = once(callback || noop);
|
5030
|
-
var _iteratee = wrapAsync
|
5049
|
+
var _iteratee = wrapAsync(iteratee);
|
5031
5050
|
|
5032
|
-
eachOf(coll, function
|
5051
|
+
eachOf(coll, function(v, k, cb) {
|
5033
5052
|
_iteratee(accumulator, v, k, cb);
|
5034
|
-
}, function
|
5053
|
+
}, function(err) {
|
5035
5054
|
callback(err, accumulator);
|
5036
5055
|
});
|
5037
5056
|
}
|
5038
5057
|
|
5058
|
+
/**
|
5059
|
+
* It runs each task in series but stops whenever any of the functions were
|
5060
|
+
* successful. If one of the tasks were successful, the `callback` will be
|
5061
|
+
* passed the result of the successful task. If all tasks fail, the callback
|
5062
|
+
* will be passed the error and result (if any) of the final attempt.
|
5063
|
+
*
|
5064
|
+
* @name tryEach
|
5065
|
+
* @static
|
5066
|
+
* @memberOf module:ControlFlow
|
5067
|
+
* @method
|
5068
|
+
* @category Control Flow
|
5069
|
+
* @param {Array|Iterable|Object} tasks - A collection containing functions to
|
5070
|
+
* run, each function is passed a `callback(err, result)` it must call on
|
5071
|
+
* completion with an error `err` (which can be `null`) and an optional `result`
|
5072
|
+
* value.
|
5073
|
+
* @param {Function} [callback] - An optional callback which is called when one
|
5074
|
+
* of the tasks has succeeded, or all have failed. It receives the `err` and
|
5075
|
+
* `result` arguments of the last attempt at completing the `task`. Invoked with
|
5076
|
+
* (err, results).
|
5077
|
+
* @example
|
5078
|
+
* async.try([
|
5079
|
+
* function getDataFromFirstWebsite(callback) {
|
5080
|
+
* // Try getting the data from the first website
|
5081
|
+
* callback(err, data);
|
5082
|
+
* },
|
5083
|
+
* function getDataFromSecondWebsite(callback) {
|
5084
|
+
* // First website failed,
|
5085
|
+
* // Try getting the data from the backup website
|
5086
|
+
* callback(err, data);
|
5087
|
+
* }
|
5088
|
+
* ],
|
5089
|
+
* // optional callback
|
5090
|
+
* function(err, results) {
|
5091
|
+
* Now do something with the data.
|
5092
|
+
* });
|
5093
|
+
*
|
5094
|
+
*/
|
5095
|
+
function tryEach(tasks, callback) {
|
5096
|
+
var error = null;
|
5097
|
+
var result;
|
5098
|
+
callback = callback || noop;
|
5099
|
+
eachSeries(tasks, function(task, callback) {
|
5100
|
+
wrapAsync(task)(function (err, res/*, ...args*/) {
|
5101
|
+
if (arguments.length > 2) {
|
5102
|
+
result = slice(arguments, 1);
|
5103
|
+
} else {
|
5104
|
+
result = res;
|
5105
|
+
}
|
5106
|
+
error = err;
|
5107
|
+
callback(!err);
|
5108
|
+
});
|
5109
|
+
}, function () {
|
5110
|
+
callback(error, result);
|
5111
|
+
});
|
5112
|
+
}
|
5113
|
+
|
5039
5114
|
/**
|
5040
5115
|
* Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original,
|
5041
5116
|
* unmemoized form. Handy for testing.
|
@@ -5091,13 +5166,14 @@ function unmemoize(fn) {
|
|
5091
5166
|
*/
|
5092
5167
|
function whilst(test, iteratee, callback) {
|
5093
5168
|
callback = onlyOnce(callback || noop);
|
5094
|
-
var _iteratee = wrapAsync
|
5169
|
+
var _iteratee = wrapAsync(iteratee);
|
5095
5170
|
if (!test()) return callback(null);
|
5096
|
-
var next =
|
5171
|
+
var next = function(err/*, ...args*/) {
|
5097
5172
|
if (err) return callback(err);
|
5098
5173
|
if (test()) return _iteratee(next);
|
5174
|
+
var args = slice(arguments, 1);
|
5099
5175
|
callback.apply(null, [null].concat(args));
|
5100
|
-
}
|
5176
|
+
};
|
5101
5177
|
_iteratee(next);
|
5102
5178
|
}
|
5103
5179
|
|
@@ -5124,7 +5200,7 @@ function whilst(test, iteratee, callback) {
|
|
5124
5200
|
* callback. Invoked with (err, [results]);
|
5125
5201
|
*/
|
5126
5202
|
function until(test, iteratee, callback) {
|
5127
|
-
whilst(function
|
5203
|
+
whilst(function() {
|
5128
5204
|
return !test.apply(this, arguments);
|
5129
5205
|
}, iteratee, callback);
|
5130
5206
|
}
|
@@ -5186,30 +5262,25 @@ function until(test, iteratee, callback) {
|
|
5186
5262
|
* callback(null, 'done');
|
5187
5263
|
* }
|
5188
5264
|
*/
|
5189
|
-
var waterfall = function
|
5265
|
+
var waterfall = function(tasks, callback) {
|
5190
5266
|
callback = once(callback || noop);
|
5191
5267
|
if (!isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions'));
|
5192
5268
|
if (!tasks.length) return callback();
|
5193
5269
|
var taskIndex = 0;
|
5194
5270
|
|
5195
5271
|
function nextTask(args) {
|
5196
|
-
|
5197
|
-
|
5198
|
-
}
|
5199
|
-
|
5200
|
-
var taskCallback = onlyOnce(rest(function (err, args) {
|
5201
|
-
if (err) {
|
5202
|
-
return callback.apply(null, [err].concat(args));
|
5203
|
-
}
|
5204
|
-
nextTask(args);
|
5205
|
-
}));
|
5206
|
-
|
5207
|
-
args.push(taskCallback);
|
5208
|
-
|
5209
|
-
var task = wrapAsync$1(tasks[taskIndex++]);
|
5272
|
+
var task = wrapAsync(tasks[taskIndex++]);
|
5273
|
+
args.push(onlyOnce(next));
|
5210
5274
|
task.apply(null, args);
|
5211
5275
|
}
|
5212
5276
|
|
5277
|
+
function next(err/*, ...args*/) {
|
5278
|
+
if (err || taskIndex === tasks.length) {
|
5279
|
+
return callback.apply(null, arguments);
|
5280
|
+
}
|
5281
|
+
nextTask(slice(arguments, 1));
|
5282
|
+
}
|
5283
|
+
|
5213
5284
|
nextTask([]);
|
5214
5285
|
};
|
5215
5286
|
|
@@ -5261,6 +5332,7 @@ var waterfall = function (tasks, callback) {
|
|
5261
5332
|
* @see AsyncFunction
|
5262
5333
|
*/
|
5263
5334
|
|
5335
|
+
|
5264
5336
|
/**
|
5265
5337
|
* A collection of `async` functions for manipulating collections, such as
|
5266
5338
|
* arrays and objects.
|
@@ -5278,104 +5350,105 @@ var waterfall = function (tasks, callback) {
|
|
5278
5350
|
*/
|
5279
5351
|
|
5280
5352
|
var index = {
|
5281
|
-
|
5282
|
-
|
5283
|
-
|
5284
|
-
|
5285
|
-
|
5286
|
-
|
5287
|
-
|
5288
|
-
|
5289
|
-
|
5290
|
-
|
5291
|
-
|
5292
|
-
|
5293
|
-
|
5294
|
-
|
5295
|
-
|
5296
|
-
|
5297
|
-
|
5298
|
-
|
5299
|
-
|
5300
|
-
|
5301
|
-
|
5302
|
-
|
5303
|
-
|
5304
|
-
|
5305
|
-
|
5306
|
-
|
5307
|
-
|
5308
|
-
|
5309
|
-
|
5310
|
-
|
5311
|
-
|
5312
|
-
|
5313
|
-
|
5314
|
-
|
5315
|
-
|
5316
|
-
|
5317
|
-
|
5318
|
-
|
5319
|
-
|
5320
|
-
|
5321
|
-
|
5322
|
-
|
5323
|
-
|
5324
|
-
|
5325
|
-
|
5326
|
-
|
5327
|
-
|
5328
|
-
|
5329
|
-
|
5330
|
-
|
5331
|
-
|
5332
|
-
|
5333
|
-
|
5334
|
-
|
5335
|
-
|
5336
|
-
|
5337
|
-
|
5338
|
-
|
5339
|
-
|
5340
|
-
|
5341
|
-
|
5342
|
-
|
5343
|
-
|
5344
|
-
|
5345
|
-
|
5346
|
-
|
5347
|
-
|
5348
|
-
|
5349
|
-
|
5350
|
-
|
5351
|
-
|
5352
|
-
|
5353
|
-
|
5354
|
-
|
5355
|
-
|
5356
|
-
|
5357
|
-
|
5358
|
-
|
5359
|
-
|
5360
|
-
|
5361
|
-
|
5362
|
-
|
5363
|
-
|
5364
|
-
|
5365
|
-
|
5366
|
-
|
5367
|
-
|
5368
|
-
|
5369
|
-
|
5370
|
-
|
5371
|
-
|
5372
|
-
|
5353
|
+
applyEach: applyEach,
|
5354
|
+
applyEachSeries: applyEachSeries,
|
5355
|
+
apply: apply,
|
5356
|
+
asyncify: asyncify,
|
5357
|
+
auto: auto,
|
5358
|
+
autoInject: autoInject,
|
5359
|
+
cargo: cargo,
|
5360
|
+
compose: compose,
|
5361
|
+
concat: concat,
|
5362
|
+
concatSeries: concatSeries,
|
5363
|
+
constant: constant,
|
5364
|
+
detect: detect,
|
5365
|
+
detectLimit: detectLimit,
|
5366
|
+
detectSeries: detectSeries,
|
5367
|
+
dir: dir,
|
5368
|
+
doDuring: doDuring,
|
5369
|
+
doUntil: doUntil,
|
5370
|
+
doWhilst: doWhilst,
|
5371
|
+
during: during,
|
5372
|
+
each: eachLimit,
|
5373
|
+
eachLimit: eachLimit$1,
|
5374
|
+
eachOf: eachOf,
|
5375
|
+
eachOfLimit: eachOfLimit,
|
5376
|
+
eachOfSeries: eachOfSeries,
|
5377
|
+
eachSeries: eachSeries,
|
5378
|
+
ensureAsync: ensureAsync,
|
5379
|
+
every: every,
|
5380
|
+
everyLimit: everyLimit,
|
5381
|
+
everySeries: everySeries,
|
5382
|
+
filter: filter,
|
5383
|
+
filterLimit: filterLimit,
|
5384
|
+
filterSeries: filterSeries,
|
5385
|
+
forever: forever,
|
5386
|
+
groupBy: groupBy,
|
5387
|
+
groupByLimit: groupByLimit,
|
5388
|
+
groupBySeries: groupBySeries,
|
5389
|
+
log: log,
|
5390
|
+
map: map,
|
5391
|
+
mapLimit: mapLimit,
|
5392
|
+
mapSeries: mapSeries,
|
5393
|
+
mapValues: mapValues,
|
5394
|
+
mapValuesLimit: mapValuesLimit,
|
5395
|
+
mapValuesSeries: mapValuesSeries,
|
5396
|
+
memoize: memoize,
|
5397
|
+
nextTick: nextTick,
|
5398
|
+
parallel: parallelLimit,
|
5399
|
+
parallelLimit: parallelLimit$1,
|
5400
|
+
priorityQueue: priorityQueue,
|
5401
|
+
queue: queue$1,
|
5402
|
+
race: race,
|
5403
|
+
reduce: reduce,
|
5404
|
+
reduceRight: reduceRight,
|
5405
|
+
reflect: reflect,
|
5406
|
+
reflectAll: reflectAll,
|
5407
|
+
reject: reject,
|
5408
|
+
rejectLimit: rejectLimit,
|
5409
|
+
rejectSeries: rejectSeries,
|
5410
|
+
retry: retry,
|
5411
|
+
retryable: retryable,
|
5412
|
+
seq: seq,
|
5413
|
+
series: series,
|
5414
|
+
setImmediate: setImmediate$1,
|
5415
|
+
some: some,
|
5416
|
+
someLimit: someLimit,
|
5417
|
+
someSeries: someSeries,
|
5418
|
+
sortBy: sortBy,
|
5419
|
+
timeout: timeout,
|
5420
|
+
times: times,
|
5421
|
+
timesLimit: timeLimit,
|
5422
|
+
timesSeries: timesSeries,
|
5423
|
+
transform: transform,
|
5424
|
+
tryEach: tryEach,
|
5425
|
+
unmemoize: unmemoize,
|
5426
|
+
until: until,
|
5427
|
+
waterfall: waterfall,
|
5428
|
+
whilst: whilst,
|
5429
|
+
|
5430
|
+
// aliases
|
5431
|
+
all: every,
|
5432
|
+
any: some,
|
5433
|
+
forEach: eachLimit,
|
5434
|
+
forEachSeries: eachSeries,
|
5435
|
+
forEachLimit: eachLimit$1,
|
5436
|
+
forEachOf: eachOf,
|
5437
|
+
forEachOfSeries: eachOfSeries,
|
5438
|
+
forEachOfLimit: eachOfLimit,
|
5439
|
+
inject: reduce,
|
5440
|
+
foldl: reduce,
|
5441
|
+
foldr: reduceRight,
|
5442
|
+
select: filter,
|
5443
|
+
selectLimit: filterLimit,
|
5444
|
+
selectSeries: filterSeries,
|
5445
|
+
wrapSync: asyncify
|
5373
5446
|
};
|
5374
5447
|
|
5375
5448
|
exports['default'] = index;
|
5376
5449
|
exports.applyEach = applyEach;
|
5377
5450
|
exports.applyEachSeries = applyEachSeries;
|
5378
|
-
exports.apply = apply
|
5451
|
+
exports.apply = apply;
|
5379
5452
|
exports.asyncify = asyncify;
|
5380
5453
|
exports.auto = auto;
|
5381
5454
|
exports.autoInject = autoInject;
|
@@ -5432,7 +5505,7 @@ exports.rejectLimit = rejectLimit;
|
|
5432
5505
|
exports.rejectSeries = rejectSeries;
|
5433
5506
|
exports.retry = retry;
|
5434
5507
|
exports.retryable = retryable;
|
5435
|
-
exports.seq = seq
|
5508
|
+
exports.seq = seq;
|
5436
5509
|
exports.series = series;
|
5437
5510
|
exports.setImmediate = setImmediate$1;
|
5438
5511
|
exports.some = some;
|
@@ -5444,6 +5517,7 @@ exports.times = times;
|
|
5444
5517
|
exports.timesLimit = timeLimit;
|
5445
5518
|
exports.timesSeries = timesSeries;
|
5446
5519
|
exports.transform = transform;
|
5520
|
+
exports.tryEach = tryEach;
|
5447
5521
|
exports.unmemoize = unmemoize;
|
5448
5522
|
exports.until = until;
|
5449
5523
|
exports.waterfall = waterfall;
|