source: trip-planner-front/node_modules/async/internal/parallel.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = _parallel;
7
8var _noop = require('lodash/noop');
9
10var _noop2 = _interopRequireDefault(_noop);
11
12var _isArrayLike = require('lodash/isArrayLike');
13
14var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
15
16var _slice = require('./slice');
17
18var _slice2 = _interopRequireDefault(_slice);
19
20var _wrapAsync = require('./wrapAsync');
21
22var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
23
24function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
26function _parallel(eachfn, tasks, callback) {
27 callback = callback || _noop2.default;
28 var results = (0, _isArrayLike2.default)(tasks) ? [] : {};
29
30 eachfn(tasks, function (task, key, callback) {
31 (0, _wrapAsync2.default)(task)(function (err, result) {
32 if (arguments.length > 2) {
33 result = (0, _slice2.default)(arguments, 1);
34 }
35 results[key] = result;
36 callback(err);
37 });
38 }, function (err) {
39 callback(err, results);
40 });
41}
42module.exports = exports['default'];
Note: See TracBrowser for help on using the repository browser.