Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/async.util.parallel/index.js
1126 views
1
'use strict';
2
3
var noop = require('async.util.noop');
4
var restParam = require('async.util.restparam');
5
var isArrayLike = require('async.util.isarraylike');
6
7
module.exports = function parallel(eachfn, tasks, cb) {
8
cb = cb || noop;
9
var results = isArrayLike(tasks) ? [] : {};
10
11
eachfn(tasks, function(task, key, cb) {
12
task(restParam(function(err, args) {
13
if (args.length <= 1) {
14
args = args[0];
15
}
16
results[key] = args;
17
cb(err);
18
}));
19
}, function(err) {
20
cb(err, results);
21
});
22
};
23
24