@nocobase/plugin-backup-restore 1.6.20 → 1.6.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/d0c15e9119b8e3d3.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +5 -5
- package/dist/node_modules/@hapi/topo/package.json +1 -1
- package/dist/node_modules/archiver/index.js +2 -2
- package/dist/node_modules/archiver/node_modules/async/all.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/allLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/allSeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/any.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/anyLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/anySeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/apply.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/applyEach.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/applyEachSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/asyncify.js +118 -0
- package/dist/node_modules/archiver/node_modules/async/auto.js +333 -0
- package/dist/node_modules/archiver/node_modules/async/autoInject.js +182 -0
- package/dist/node_modules/archiver/node_modules/async/bower.json +17 -0
- package/dist/node_modules/archiver/node_modules/async/cargo.js +63 -0
- package/dist/node_modules/archiver/node_modules/async/cargoQueue.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/compose.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/concat.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/concatLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/concatSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/constant.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/detect.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/detectLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/detectSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/dir.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.js +6062 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.min.js +1 -0
- package/dist/node_modules/archiver/node_modules/async/doDuring.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/doUntil.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/doWhilst.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/during.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/each.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/eachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/eachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/eachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/ensureAsync.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/every.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/everyLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/everySeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filter.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/filterLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filterSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/find.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/findLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/findSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/flatMap.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/foldl.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/foldr.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/forEach.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/forEachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/forEachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/forever.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/groupBy.js +108 -0
- package/dist/node_modules/archiver/node_modules/async/groupByLimit.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/groupBySeries.js +36 -0
- package/dist/node_modules/archiver/node_modules/async/index.js +588 -0
- package/dist/node_modules/archiver/node_modules/async/inject.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/internal/DoublyLinkedList.js +92 -0
- package/dist/node_modules/archiver/node_modules/async/internal/Heap.js +120 -0
- package/dist/node_modules/archiver/node_modules/async/internal/applyEach.js +29 -0
- package/dist/node_modules/archiver/node_modules/async/internal/asyncEachOfLimit.js +75 -0
- package/dist/node_modules/archiver/node_modules/async/internal/awaitify.js +28 -0
- package/dist/node_modules/archiver/node_modules/async/internal/breakLoop.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/consoleFunc.js +31 -0
- package/dist/node_modules/archiver/node_modules/async/internal/createTester.js +40 -0
- package/dist/node_modules/archiver/node_modules/async/internal/eachOfLimit.js +90 -0
- package/dist/node_modules/archiver/node_modules/async/internal/filter.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/internal/getIterator.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/internal/initialParams.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/isArrayLike.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/iterator.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/internal/map.js +30 -0
- package/dist/node_modules/archiver/node_modules/async/internal/once.js +17 -0
- package/dist/node_modules/archiver/node_modules/async/internal/onlyOnce.js +15 -0
- package/dist/node_modules/archiver/node_modules/async/internal/parallel.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/promiseCallback.js +23 -0
- package/dist/node_modules/archiver/node_modules/async/internal/queue.js +294 -0
- package/dist/node_modules/archiver/node_modules/async/internal/range.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/reject.js +26 -0
- package/dist/node_modules/archiver/node_modules/async/internal/setImmediate.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/withoutIndex.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/wrapAsync.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/log.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/map.js +142 -0
- package/dist/node_modules/archiver/node_modules/async/mapLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/mapSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/mapValues.js +152 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesLimit.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/memoize.js +91 -0
- package/dist/node_modules/archiver/node_modules/async/nextTick.js +52 -0
- package/dist/node_modules/archiver/node_modules/async/package.json +75 -0
- package/dist/node_modules/archiver/node_modules/async/parallel.js +180 -0
- package/dist/node_modules/archiver/node_modules/async/parallelLimit.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/priorityQueue.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/queue.js +24 -0
- package/dist/node_modules/archiver/node_modules/async/race.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/reduce.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/reduceRight.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/reflect.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/reflectAll.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/reject.js +87 -0
- package/dist/node_modules/archiver/node_modules/async/rejectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/rejectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/retry.js +159 -0
- package/dist/node_modules/archiver/node_modules/async/retryable.js +77 -0
- package/dist/node_modules/archiver/node_modules/async/select.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/selectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/selectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/seq.js +79 -0
- package/dist/node_modules/archiver/node_modules/async/series.js +186 -0
- package/dist/node_modules/archiver/node_modules/async/setImmediate.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/some.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/someLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/someSeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/sortBy.js +190 -0
- package/dist/node_modules/archiver/node_modules/async/timeout.js +89 -0
- package/dist/node_modules/archiver/node_modules/async/times.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/timesLimit.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/timesSeries.js +32 -0
- package/dist/node_modules/archiver/node_modules/async/transform.js +173 -0
- package/dist/node_modules/archiver/node_modules/async/tryEach.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/unmemoize.js +25 -0
- package/dist/node_modules/archiver/node_modules/async/until.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/waterfall.js +105 -0
- package/dist/node_modules/archiver/node_modules/async/whilst.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/wrapSync.js +118 -0
- package/dist/node_modules/archiver/package.json +1 -1
- package/dist/node_modules/decompress/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/moment/package.json +1 -1
- package/dist/node_modules/semver/bin/semver.js +7 -15
- package/dist/node_modules/semver/classes/range.js +28 -13
- package/dist/node_modules/semver/classes/semver.js +23 -7
- package/dist/node_modules/semver/functions/diff.js +5 -12
- package/dist/node_modules/semver/index.js +1 -1
- package/dist/node_modules/semver/internal/lrucache.js +40 -0
- package/dist/node_modules/semver/internal/re.js +2 -0
- package/dist/node_modules/semver/package.json +1 -1
- package/package.json +3 -3
- package/dist/client/04e68bac2ed0170d.js +0 -10
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
|
+
|
|
9
|
+
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
|
+
|
|
11
|
+
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
|
12
|
+
|
|
13
|
+
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
|
14
|
+
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
|
+
|
|
17
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
|
+
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a
|
|
23
|
+
* time.
|
|
24
|
+
*
|
|
25
|
+
* @name detectLimit
|
|
26
|
+
* @static
|
|
27
|
+
* @memberOf module:Collections
|
|
28
|
+
* @method
|
|
29
|
+
* @see [async.detect]{@link module:Collections.detect}
|
|
30
|
+
* @alias findLimit
|
|
31
|
+
* @category Collections
|
|
32
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
33
|
+
* @param {number} limit - The maximum number of async operations at a time.
|
|
34
|
+
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
|
|
35
|
+
* The iteratee must complete with a boolean value as its result.
|
|
36
|
+
* Invoked with (item, callback).
|
|
37
|
+
* @param {Function} [callback] - A callback which is called as soon as any
|
|
38
|
+
* iteratee returns `true`, or after all the `iteratee` functions have finished.
|
|
39
|
+
* Result will be the first item in the array that passes the truth test
|
|
40
|
+
* (iteratee) or the value `undefined` if none passed. Invoked with
|
|
41
|
+
* (err, result).
|
|
42
|
+
* @returns {Promise} a promise, if a callback is omitted
|
|
43
|
+
*/
|
|
44
|
+
function detectLimit(coll, limit, iteratee, callback) {
|
|
45
|
+
return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
|
|
46
|
+
}
|
|
47
|
+
exports.default = (0, _awaitify2.default)(detectLimit, 4);
|
|
48
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
|
+
|
|
9
|
+
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
|
+
|
|
11
|
+
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
|
12
|
+
|
|
13
|
+
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
|
14
|
+
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
|
+
|
|
17
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
|
+
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.
|
|
23
|
+
*
|
|
24
|
+
* @name detectSeries
|
|
25
|
+
* @static
|
|
26
|
+
* @memberOf module:Collections
|
|
27
|
+
* @method
|
|
28
|
+
* @see [async.detect]{@link module:Collections.detect}
|
|
29
|
+
* @alias findSeries
|
|
30
|
+
* @category Collections
|
|
31
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
32
|
+
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
|
|
33
|
+
* The iteratee must complete with a boolean value as its result.
|
|
34
|
+
* Invoked with (item, callback).
|
|
35
|
+
* @param {Function} [callback] - A callback which is called as soon as any
|
|
36
|
+
* iteratee returns `true`, or after all the `iteratee` functions have finished.
|
|
37
|
+
* Result will be the first item in the array that passes the truth test
|
|
38
|
+
* (iteratee) or the value `undefined` if none passed. Invoked with
|
|
39
|
+
* (err, result).
|
|
40
|
+
* @returns {Promise} a promise, if a callback is omitted
|
|
41
|
+
*/
|
|
42
|
+
function detectSeries(coll, iteratee, callback) {
|
|
43
|
+
return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(1), coll, iteratee, callback);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exports.default = (0, _awaitify2.default)(detectSeries, 3);
|
|
47
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _concatLimit = require('./concatLimit.js');
|
|
8
|
+
|
|
9
|
+
var _concatLimit2 = _interopRequireDefault(_concatLimit);
|
|
10
|
+
|
|
11
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
12
|
+
|
|
13
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Applies `iteratee` to each item in `coll`, concatenating the results. Returns
|
|
19
|
+
* the concatenated list. The `iteratee`s are called in parallel, and the
|
|
20
|
+
* results are concatenated as they return. The results array will be returned in
|
|
21
|
+
* the original order of `coll` passed to the `iteratee` function.
|
|
22
|
+
*
|
|
23
|
+
* @name concat
|
|
24
|
+
* @static
|
|
25
|
+
* @memberOf module:Collections
|
|
26
|
+
* @method
|
|
27
|
+
* @category Collection
|
|
28
|
+
* @alias flatMap
|
|
29
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
30
|
+
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
|
|
31
|
+
* which should use an array as its result. Invoked with (item, callback).
|
|
32
|
+
* @param {Function} [callback] - A callback which is called after all the
|
|
33
|
+
* `iteratee` functions have finished, or an error occurs. Results is an array
|
|
34
|
+
* containing the concatenated results of the `iteratee` function. Invoked with
|
|
35
|
+
* (err, results).
|
|
36
|
+
* @returns A Promise, if no callback is passed
|
|
37
|
+
* @example
|
|
38
|
+
*
|
|
39
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
40
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
41
|
+
* // dir3 is a directory that contains file5.txt
|
|
42
|
+
* // dir4 does not exist
|
|
43
|
+
*
|
|
44
|
+
* let directoryList = ['dir1','dir2','dir3'];
|
|
45
|
+
* let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
|
|
46
|
+
*
|
|
47
|
+
* // Using callbacks
|
|
48
|
+
* async.concat(directoryList, fs.readdir, function(err, results) {
|
|
49
|
+
* if (err) {
|
|
50
|
+
* console.log(err);
|
|
51
|
+
* } else {
|
|
52
|
+
* console.log(results);
|
|
53
|
+
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
54
|
+
* }
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* // Error Handling
|
|
58
|
+
* async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
|
|
59
|
+
* if (err) {
|
|
60
|
+
* console.log(err);
|
|
61
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
62
|
+
* // since dir4 does not exist
|
|
63
|
+
* } else {
|
|
64
|
+
* console.log(results);
|
|
65
|
+
* }
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* // Using Promises
|
|
69
|
+
* async.concat(directoryList, fs.readdir)
|
|
70
|
+
* .then(results => {
|
|
71
|
+
* console.log(results);
|
|
72
|
+
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
73
|
+
* }).catch(err => {
|
|
74
|
+
* console.log(err);
|
|
75
|
+
* });
|
|
76
|
+
*
|
|
77
|
+
* // Error Handling
|
|
78
|
+
* async.concat(withMissingDirectoryList, fs.readdir)
|
|
79
|
+
* .then(results => {
|
|
80
|
+
* console.log(results);
|
|
81
|
+
* }).catch(err => {
|
|
82
|
+
* console.log(err);
|
|
83
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
84
|
+
* // since dir4 does not exist
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* // Using async/await
|
|
88
|
+
* async () => {
|
|
89
|
+
* try {
|
|
90
|
+
* let results = await async.concat(directoryList, fs.readdir);
|
|
91
|
+
* console.log(results);
|
|
92
|
+
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
93
|
+
* } catch (err) {
|
|
94
|
+
* console.log(err);
|
|
95
|
+
* }
|
|
96
|
+
* }
|
|
97
|
+
*
|
|
98
|
+
* // Error Handling
|
|
99
|
+
* async () => {
|
|
100
|
+
* try {
|
|
101
|
+
* let results = await async.concat(withMissingDirectoryList, fs.readdir);
|
|
102
|
+
* console.log(results);
|
|
103
|
+
* } catch (err) {
|
|
104
|
+
* console.log(err);
|
|
105
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
106
|
+
* // since dir4 does not exist
|
|
107
|
+
* }
|
|
108
|
+
* }
|
|
109
|
+
*
|
|
110
|
+
*/
|
|
111
|
+
function concat(coll, iteratee, callback) {
|
|
112
|
+
return (0, _concatLimit2.default)(coll, Infinity, iteratee, callback);
|
|
113
|
+
}
|
|
114
|
+
exports.default = (0, _awaitify2.default)(concat, 3);
|
|
115
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
8
|
+
|
|
9
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
10
|
+
|
|
11
|
+
var _mapLimit = require('./mapLimit.js');
|
|
12
|
+
|
|
13
|
+
var _mapLimit2 = _interopRequireDefault(_mapLimit);
|
|
14
|
+
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
|
+
|
|
17
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
|
+
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time.
|
|
23
|
+
*
|
|
24
|
+
* @name concatLimit
|
|
25
|
+
* @static
|
|
26
|
+
* @memberOf module:Collections
|
|
27
|
+
* @method
|
|
28
|
+
* @see [async.concat]{@link module:Collections.concat}
|
|
29
|
+
* @category Collection
|
|
30
|
+
* @alias flatMapLimit
|
|
31
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
32
|
+
* @param {number} limit - The maximum number of async operations at a time.
|
|
33
|
+
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
|
|
34
|
+
* which should use an array as its result. Invoked with (item, callback).
|
|
35
|
+
* @param {Function} [callback] - A callback which is called after all the
|
|
36
|
+
* `iteratee` functions have finished, or an error occurs. Results is an array
|
|
37
|
+
* containing the concatenated results of the `iteratee` function. Invoked with
|
|
38
|
+
* (err, results).
|
|
39
|
+
* @returns A Promise, if no callback is passed
|
|
40
|
+
*/
|
|
41
|
+
function concatLimit(coll, limit, iteratee, callback) {
|
|
42
|
+
var _iteratee = (0, _wrapAsync2.default)(iteratee);
|
|
43
|
+
return (0, _mapLimit2.default)(coll, limit, (val, iterCb) => {
|
|
44
|
+
_iteratee(val, (err, ...args) => {
|
|
45
|
+
if (err) return iterCb(err);
|
|
46
|
+
return iterCb(err, args);
|
|
47
|
+
});
|
|
48
|
+
}, (err, mapResults) => {
|
|
49
|
+
var result = [];
|
|
50
|
+
for (var i = 0; i < mapResults.length; i++) {
|
|
51
|
+
if (mapResults[i]) {
|
|
52
|
+
result = result.concat(...mapResults[i]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return callback(err, result);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.default = (0, _awaitify2.default)(concatLimit, 4);
|
|
60
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _concatLimit = require('./concatLimit.js');
|
|
8
|
+
|
|
9
|
+
var _concatLimit2 = _interopRequireDefault(_concatLimit);
|
|
10
|
+
|
|
11
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
12
|
+
|
|
13
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time.
|
|
19
|
+
*
|
|
20
|
+
* @name concatSeries
|
|
21
|
+
* @static
|
|
22
|
+
* @memberOf module:Collections
|
|
23
|
+
* @method
|
|
24
|
+
* @see [async.concat]{@link module:Collections.concat}
|
|
25
|
+
* @category Collection
|
|
26
|
+
* @alias flatMapSeries
|
|
27
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
28
|
+
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`.
|
|
29
|
+
* The iteratee should complete with an array an array of results.
|
|
30
|
+
* Invoked with (item, callback).
|
|
31
|
+
* @param {Function} [callback] - A callback which is called after all the
|
|
32
|
+
* `iteratee` functions have finished, or an error occurs. Results is an array
|
|
33
|
+
* containing the concatenated results of the `iteratee` function. Invoked with
|
|
34
|
+
* (err, results).
|
|
35
|
+
* @returns A Promise, if no callback is passed
|
|
36
|
+
*/
|
|
37
|
+
function concatSeries(coll, iteratee, callback) {
|
|
38
|
+
return (0, _concatLimit2.default)(coll, 1, iteratee, callback);
|
|
39
|
+
}
|
|
40
|
+
exports.default = (0, _awaitify2.default)(concatSeries, 3);
|
|
41
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _eachOfSeries = require('./eachOfSeries.js');
|
|
8
|
+
|
|
9
|
+
var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
|
10
|
+
|
|
11
|
+
var _once = require('./internal/once.js');
|
|
12
|
+
|
|
13
|
+
var _once2 = _interopRequireDefault(_once);
|
|
14
|
+
|
|
15
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
16
|
+
|
|
17
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
18
|
+
|
|
19
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
20
|
+
|
|
21
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Reduces `coll` into a single value using an async `iteratee` to return each
|
|
27
|
+
* successive step. `memo` is the initial state of the reduction. This function
|
|
28
|
+
* only operates in series.
|
|
29
|
+
*
|
|
30
|
+
* For performance reasons, it may make sense to split a call to this function
|
|
31
|
+
* into a parallel map, and then use the normal `Array.prototype.reduce` on the
|
|
32
|
+
* results. This function is for situations where each step in the reduction
|
|
33
|
+
* needs to be async; if you can get the data before reducing it, then it's
|
|
34
|
+
* probably a good idea to do so.
|
|
35
|
+
*
|
|
36
|
+
* @name reduce
|
|
37
|
+
* @static
|
|
38
|
+
* @memberOf module:Collections
|
|
39
|
+
* @method
|
|
40
|
+
* @alias inject
|
|
41
|
+
* @alias foldl
|
|
42
|
+
* @category Collection
|
|
43
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
44
|
+
* @param {*} memo - The initial state of the reduction.
|
|
45
|
+
* @param {AsyncFunction} iteratee - A function applied to each item in the
|
|
46
|
+
* array to produce the next step in the reduction.
|
|
47
|
+
* The `iteratee` should complete with the next state of the reduction.
|
|
48
|
+
* If the iteratee completes with an error, the reduction is stopped and the
|
|
49
|
+
* main `callback` is immediately called with the error.
|
|
50
|
+
* Invoked with (memo, item, callback).
|
|
51
|
+
* @param {Function} [callback] - A callback which is called after all the
|
|
52
|
+
* `iteratee` functions have finished. Result is the reduced value. Invoked with
|
|
53
|
+
* (err, result).
|
|
54
|
+
* @returns {Promise} a promise, if no callback is passed
|
|
55
|
+
* @example
|
|
56
|
+
*
|
|
57
|
+
* // file1.txt is a file that is 1000 bytes in size
|
|
58
|
+
* // file2.txt is a file that is 2000 bytes in size
|
|
59
|
+
* // file3.txt is a file that is 3000 bytes in size
|
|
60
|
+
* // file4.txt does not exist
|
|
61
|
+
*
|
|
62
|
+
* const fileList = ['file1.txt','file2.txt','file3.txt'];
|
|
63
|
+
* const withMissingFileList = ['file1.txt','file2.txt','file3.txt', 'file4.txt'];
|
|
64
|
+
*
|
|
65
|
+
* // asynchronous function that computes the file size in bytes
|
|
66
|
+
* // file size is added to the memoized value, then returned
|
|
67
|
+
* function getFileSizeInBytes(memo, file, callback) {
|
|
68
|
+
* fs.stat(file, function(err, stat) {
|
|
69
|
+
* if (err) {
|
|
70
|
+
* return callback(err);
|
|
71
|
+
* }
|
|
72
|
+
* callback(null, memo + stat.size);
|
|
73
|
+
* });
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* // Using callbacks
|
|
77
|
+
* async.reduce(fileList, 0, getFileSizeInBytes, function(err, result) {
|
|
78
|
+
* if (err) {
|
|
79
|
+
* console.log(err);
|
|
80
|
+
* } else {
|
|
81
|
+
* console.log(result);
|
|
82
|
+
* // 6000
|
|
83
|
+
* // which is the sum of the file sizes of the three files
|
|
84
|
+
* }
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* // Error Handling
|
|
88
|
+
* async.reduce(withMissingFileList, 0, getFileSizeInBytes, function(err, result) {
|
|
89
|
+
* if (err) {
|
|
90
|
+
* console.log(err);
|
|
91
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
92
|
+
* } else {
|
|
93
|
+
* console.log(result);
|
|
94
|
+
* }
|
|
95
|
+
* });
|
|
96
|
+
*
|
|
97
|
+
* // Using Promises
|
|
98
|
+
* async.reduce(fileList, 0, getFileSizeInBytes)
|
|
99
|
+
* .then( result => {
|
|
100
|
+
* console.log(result);
|
|
101
|
+
* // 6000
|
|
102
|
+
* // which is the sum of the file sizes of the three files
|
|
103
|
+
* }).catch( err => {
|
|
104
|
+
* console.log(err);
|
|
105
|
+
* });
|
|
106
|
+
*
|
|
107
|
+
* // Error Handling
|
|
108
|
+
* async.reduce(withMissingFileList, 0, getFileSizeInBytes)
|
|
109
|
+
* .then( result => {
|
|
110
|
+
* console.log(result);
|
|
111
|
+
* }).catch( err => {
|
|
112
|
+
* console.log(err);
|
|
113
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
114
|
+
* });
|
|
115
|
+
*
|
|
116
|
+
* // Using async/await
|
|
117
|
+
* async () => {
|
|
118
|
+
* try {
|
|
119
|
+
* let result = await async.reduce(fileList, 0, getFileSizeInBytes);
|
|
120
|
+
* console.log(result);
|
|
121
|
+
* // 6000
|
|
122
|
+
* // which is the sum of the file sizes of the three files
|
|
123
|
+
* }
|
|
124
|
+
* catch (err) {
|
|
125
|
+
* console.log(err);
|
|
126
|
+
* }
|
|
127
|
+
* }
|
|
128
|
+
*
|
|
129
|
+
* // Error Handling
|
|
130
|
+
* async () => {
|
|
131
|
+
* try {
|
|
132
|
+
* let result = await async.reduce(withMissingFileList, 0, getFileSizeInBytes);
|
|
133
|
+
* console.log(result);
|
|
134
|
+
* }
|
|
135
|
+
* catch (err) {
|
|
136
|
+
* console.log(err);
|
|
137
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
138
|
+
* }
|
|
139
|
+
* }
|
|
140
|
+
*
|
|
141
|
+
*/
|
|
142
|
+
function reduce(coll, memo, iteratee, callback) {
|
|
143
|
+
callback = (0, _once2.default)(callback);
|
|
144
|
+
var _iteratee = (0, _wrapAsync2.default)(iteratee);
|
|
145
|
+
return (0, _eachOfSeries2.default)(coll, (x, i, iterCb) => {
|
|
146
|
+
_iteratee(memo, x, (err, v) => {
|
|
147
|
+
memo = v;
|
|
148
|
+
iterCb(err);
|
|
149
|
+
});
|
|
150
|
+
}, err => callback(err, memo));
|
|
151
|
+
}
|
|
152
|
+
exports.default = (0, _awaitify2.default)(reduce, 4);
|
|
153
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = reduceRight;
|
|
7
|
+
|
|
8
|
+
var _reduce = require('./reduce.js');
|
|
9
|
+
|
|
10
|
+
var _reduce2 = _interopRequireDefault(_reduce);
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.
|
|
16
|
+
*
|
|
17
|
+
* @name reduceRight
|
|
18
|
+
* @static
|
|
19
|
+
* @memberOf module:Collections
|
|
20
|
+
* @method
|
|
21
|
+
* @see [async.reduce]{@link module:Collections.reduce}
|
|
22
|
+
* @alias foldr
|
|
23
|
+
* @category Collection
|
|
24
|
+
* @param {Array} array - A collection to iterate over.
|
|
25
|
+
* @param {*} memo - The initial state of the reduction.
|
|
26
|
+
* @param {AsyncFunction} iteratee - A function applied to each item in the
|
|
27
|
+
* array to produce the next step in the reduction.
|
|
28
|
+
* The `iteratee` should complete with the next state of the reduction.
|
|
29
|
+
* If the iteratee completes with an error, the reduction is stopped and the
|
|
30
|
+
* main `callback` is immediately called with the error.
|
|
31
|
+
* Invoked with (memo, item, callback).
|
|
32
|
+
* @param {Function} [callback] - A callback which is called after all the
|
|
33
|
+
* `iteratee` functions have finished. Result is the reduced value. Invoked with
|
|
34
|
+
* (err, result).
|
|
35
|
+
* @returns {Promise} a promise, if no callback is passed
|
|
36
|
+
*/
|
|
37
|
+
function reduceRight(array, memo, iteratee, callback) {
|
|
38
|
+
var reversed = [...array].reverse();
|
|
39
|
+
return (0, _reduce2.default)(reversed, memo, iteratee, callback);
|
|
40
|
+
}
|
|
41
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _eachOf = require('./eachOf.js');
|
|
8
|
+
|
|
9
|
+
var _eachOf2 = _interopRequireDefault(_eachOf);
|
|
10
|
+
|
|
11
|
+
var _withoutIndex = require('./internal/withoutIndex.js');
|
|
12
|
+
|
|
13
|
+
var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
|
|
14
|
+
|
|
15
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
16
|
+
|
|
17
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
18
|
+
|
|
19
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
20
|
+
|
|
21
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Applies the function `iteratee` to each item in `coll`, in parallel.
|
|
27
|
+
* The `iteratee` is called with an item from the list, and a callback for when
|
|
28
|
+
* it has finished. If the `iteratee` passes an error to its `callback`, the
|
|
29
|
+
* main `callback` (for the `each` function) is immediately called with the
|
|
30
|
+
* error.
|
|
31
|
+
*
|
|
32
|
+
* Note, that since this function applies `iteratee` to each item in parallel,
|
|
33
|
+
* there is no guarantee that the iteratee functions will complete in order.
|
|
34
|
+
*
|
|
35
|
+
* @name each
|
|
36
|
+
* @static
|
|
37
|
+
* @memberOf module:Collections
|
|
38
|
+
* @method
|
|
39
|
+
* @alias forEach
|
|
40
|
+
* @category Collection
|
|
41
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
42
|
+
* @param {AsyncFunction} iteratee - An async function to apply to
|
|
43
|
+
* each item in `coll`. Invoked with (item, callback).
|
|
44
|
+
* The array index is not passed to the iteratee.
|
|
45
|
+
* If you need the index, use `eachOf`.
|
|
46
|
+
* @param {Function} [callback] - A callback which is called when all
|
|
47
|
+
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
|
48
|
+
* @returns {Promise} a promise, if a callback is omitted
|
|
49
|
+
* @example
|
|
50
|
+
*
|
|
51
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
52
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
53
|
+
* // dir3 is a directory that contains file5.txt
|
|
54
|
+
* // dir4 does not exist
|
|
55
|
+
*
|
|
56
|
+
* const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt'];
|
|
57
|
+
* const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt'];
|
|
58
|
+
*
|
|
59
|
+
* // asynchronous function that deletes a file
|
|
60
|
+
* const deleteFile = function(file, callback) {
|
|
61
|
+
* fs.unlink(file, callback);
|
|
62
|
+
* };
|
|
63
|
+
*
|
|
64
|
+
* // Using callbacks
|
|
65
|
+
* async.each(fileList, deleteFile, function(err) {
|
|
66
|
+
* if( err ) {
|
|
67
|
+
* console.log(err);
|
|
68
|
+
* } else {
|
|
69
|
+
* console.log('All files have been deleted successfully');
|
|
70
|
+
* }
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* // Error Handling
|
|
74
|
+
* async.each(withMissingFileList, deleteFile, function(err){
|
|
75
|
+
* console.log(err);
|
|
76
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
77
|
+
* // since dir4/file2.txt does not exist
|
|
78
|
+
* // dir1/file1.txt could have been deleted
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* // Using Promises
|
|
82
|
+
* async.each(fileList, deleteFile)
|
|
83
|
+
* .then( () => {
|
|
84
|
+
* console.log('All files have been deleted successfully');
|
|
85
|
+
* }).catch( err => {
|
|
86
|
+
* console.log(err);
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* // Error Handling
|
|
90
|
+
* async.each(fileList, deleteFile)
|
|
91
|
+
* .then( () => {
|
|
92
|
+
* console.log('All files have been deleted successfully');
|
|
93
|
+
* }).catch( err => {
|
|
94
|
+
* console.log(err);
|
|
95
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
96
|
+
* // since dir4/file2.txt does not exist
|
|
97
|
+
* // dir1/file1.txt could have been deleted
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* // Using async/await
|
|
101
|
+
* async () => {
|
|
102
|
+
* try {
|
|
103
|
+
* await async.each(files, deleteFile);
|
|
104
|
+
* }
|
|
105
|
+
* catch (err) {
|
|
106
|
+
* console.log(err);
|
|
107
|
+
* }
|
|
108
|
+
* }
|
|
109
|
+
*
|
|
110
|
+
* // Error Handling
|
|
111
|
+
* async () => {
|
|
112
|
+
* try {
|
|
113
|
+
* await async.each(withMissingFileList, deleteFile);
|
|
114
|
+
* }
|
|
115
|
+
* catch (err) {
|
|
116
|
+
* console.log(err);
|
|
117
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
118
|
+
* // since dir4/file2.txt does not exist
|
|
119
|
+
* // dir1/file1.txt could have been deleted
|
|
120
|
+
* }
|
|
121
|
+
* }
|
|
122
|
+
*
|
|
123
|
+
*/
|
|
124
|
+
function eachLimit(coll, iteratee, callback) {
|
|
125
|
+
return (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
exports.default = (0, _awaitify2.default)(eachLimit, 3);
|
|
129
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
|
8
|
+
|
|
9
|
+
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
|
10
|
+
|
|
11
|
+
var _withoutIndex = require('./internal/withoutIndex.js');
|
|
12
|
+
|
|
13
|
+
var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
|
|
14
|
+
|
|
15
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
16
|
+
|
|
17
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
18
|
+
|
|
19
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
20
|
+
|
|
21
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
|
|
27
|
+
*
|
|
28
|
+
* @name eachLimit
|
|
29
|
+
* @static
|
|
30
|
+
* @memberOf module:Collections
|
|
31
|
+
* @method
|
|
32
|
+
* @see [async.each]{@link module:Collections.each}
|
|
33
|
+
* @alias forEachLimit
|
|
34
|
+
* @category Collection
|
|
35
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
36
|
+
* @param {number} limit - The maximum number of async operations at a time.
|
|
37
|
+
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
38
|
+
* `coll`.
|
|
39
|
+
* The array index is not passed to the iteratee.
|
|
40
|
+
* If you need the index, use `eachOfLimit`.
|
|
41
|
+
* Invoked with (item, callback).
|
|
42
|
+
* @param {Function} [callback] - A callback which is called when all
|
|
43
|
+
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
|
44
|
+
* @returns {Promise} a promise, if a callback is omitted
|
|
45
|
+
*/
|
|
46
|
+
function eachLimit(coll, limit, iteratee, callback) {
|
|
47
|
+
return (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
|
|
48
|
+
}
|
|
49
|
+
exports.default = (0, _awaitify2.default)(eachLimit, 4);
|
|
50
|
+
module.exports = exports.default;
|