Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / form-data / node_modules / async / parallel.js
1 'use strict';
2
3 Object.defineProperty(exports, "__esModule", {
4   value: true
5 });
6 exports.default = parallelLimit;
7
8 var _eachOf = require('./eachOf');
9
10 var _eachOf2 = _interopRequireDefault(_eachOf);
11
12 var _parallel = require('./internal/parallel');
13
14 var _parallel2 = _interopRequireDefault(_parallel);
15
16 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
18 /**
19  * Run the `tasks` collection of functions in parallel, without waiting until
20  * the previous function has completed. If any of the functions pass an error to
21  * its callback, the main `callback` is immediately called with the value of the
22  * error. Once the `tasks` have completed, the results are passed to the final
23  * `callback` as an array.
24  *
25  * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about
26  * parallel execution of code.  If your tasks do not use any timers or perform
27  * any I/O, they will actually be executed in series.  Any synchronous setup
28  * sections for each task will happen one after the other.  JavaScript remains
29  * single-threaded.
30  *
31  * It is also possible to use an object instead of an array. Each property will
32  * be run as a function and the results will be passed to the final `callback`
33  * as an object instead of an array. This can be a more readable way of handling
34  * results from {@link async.parallel}.
35  *
36  * @name parallel
37  * @static
38  * @memberOf module:ControlFlow
39  * @method
40  * @category Control Flow
41  * @param {Array|Iterable|Object} tasks - A collection containing functions to run.
42  * Each function is passed a `callback(err, result)` which it must call on
43  * completion with an error `err` (which can be `null`) and an optional `result`
44  * value.
45  * @param {Function} [callback] - An optional callback to run once all the
46  * functions have completed successfully. This function gets a results array
47  * (or object) containing all the result arguments passed to the task callbacks.
48  * Invoked with (err, results).
49  * @example
50  * async.parallel([
51  *     function(callback) {
52  *         setTimeout(function() {
53  *             callback(null, 'one');
54  *         }, 200);
55  *     },
56  *     function(callback) {
57  *         setTimeout(function() {
58  *             callback(null, 'two');
59  *         }, 100);
60  *     }
61  * ],
62  * // optional callback
63  * function(err, results) {
64  *     // the results array will equal ['one','two'] even though
65  *     // the second function had a shorter timeout.
66  * });
67  *
68  * // an example using an object instead of an array
69  * async.parallel({
70  *     one: function(callback) {
71  *         setTimeout(function() {
72  *             callback(null, 1);
73  *         }, 200);
74  *     },
75  *     two: function(callback) {
76  *         setTimeout(function() {
77  *             callback(null, 2);
78  *         }, 100);
79  *     }
80  * }, function(err, results) {
81  *     // results is now equals to: {one: 1, two: 2}
82  * });
83  */
84 function parallelLimit(tasks, callback) {
85   (0, _parallel2.default)(_eachOf2.default, tasks, callback);
86 }
87 module.exports = exports['default'];