summaryrefslogtreecommitdiff
path: root/lib/eachLimit.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/eachLimit.js')
-rw-r--r--lib/eachLimit.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/eachLimit.js b/lib/eachLimit.js
index e4d67cb..5c491e8 100644
--- a/lib/eachLimit.js
+++ b/lib/eachLimit.js
@@ -1,6 +1,7 @@
import eachOfLimit from './internal/eachOfLimit';
import withoutIndex from './internal/withoutIndex';
import wrapAsync from './internal/wrapAsync';
+import awaitify from './internal/awaitify'
/**
* The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
@@ -21,7 +22,9 @@ import wrapAsync from './internal/wrapAsync';
* Invoked with (item, callback).
* @param {Function} [callback] - A callback which is called when all
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
+ * @returns {Promise} a promise, if a callback is omitted
*/
-export default function eachLimit(coll, limit, iteratee, callback) {
- eachOfLimit(limit)(coll, withoutIndex(wrapAsync(iteratee)), callback);
+function eachLimit(coll, limit, iteratee, callback) {
+ return eachOfLimit(limit)(coll, withoutIndex(wrapAsync(iteratee)), callback);
}
+export default awaitify(eachLimit, 4)