Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / form-data / node_modules / async / each.js
1 'use strict';
2
3 Object.defineProperty(exports, "__esModule", {
4   value: true
5 });
6 exports.default = eachLimit;
7
8 var _eachOf = require('./eachOf');
9
10 var _eachOf2 = _interopRequireDefault(_eachOf);
11
12 var _withoutIndex = require('./internal/withoutIndex');
13
14 var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
15
16 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
18 /**
19  * Applies the function `iteratee` to each item in `coll`, in parallel.
20  * The `iteratee` is called with an item from the list, and a callback for when
21  * it has finished. If the `iteratee` passes an error to its `callback`, the
22  * main `callback` (for the `each` function) is immediately called with the
23  * error.
24  *
25  * Note, that since this function applies `iteratee` to each item in parallel,
26  * there is no guarantee that the iteratee functions will complete in order.
27  *
28  * @name each
29  * @static
30  * @memberOf module:Collections
31  * @method
32  * @alias forEach
33  * @category Collection
34  * @param {Array|Iterable|Object} coll - A collection to iterate over.
35  * @param {Function} iteratee - A function to apply to each item
36  * in `coll`. The iteratee is passed a `callback(err)` which must be called once
37  * it has completed. If no error has occurred, the `callback` should be run
38  * without arguments or with an explicit `null` argument. The array index is not
39  * passed to the iteratee. Invoked with (item, callback). If you need the index,
40  * use `eachOf`.
41  * @param {Function} [callback] - A callback which is called when all
42  * `iteratee` functions have finished, or an error occurs. Invoked with (err).
43  * @example
44  *
45  * // assuming openFiles is an array of file names and saveFile is a function
46  * // to save the modified contents of that file:
47  *
48  * async.each(openFiles, saveFile, function(err){
49  *   // if any of the saves produced an error, err would equal that error
50  * });
51  *
52  * // assuming openFiles is an array of file names
53  * async.each(openFiles, function(file, callback) {
54  *
55  *     // Perform operation on file here.
56  *     console.log('Processing file ' + file);
57  *
58  *     if( file.length > 32 ) {
59  *       console.log('This file name is too long');
60  *       callback('File name too long');
61  *     } else {
62  *       // Do work to process file here
63  *       console.log('File processed');
64  *       callback();
65  *     }
66  * }, function(err) {
67  *     // if any of the file processing produced an error, err would equal that error
68  *     if( err ) {
69  *       // One of the iterations produced an error.
70  *       // All processing will now stop.
71  *       console.log('A file failed to process');
72  *     } else {
73  *       console.log('All files have been processed successfully');
74  *     }
75  * });
76  */
77 function eachLimit(coll, iteratee, callback) {
78   (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)(iteratee), callback);
79 }
80 module.exports = exports['default'];