summaryrefslogtreecommitdiff
path: root/lib/internal/parallel.js
diff options
context:
space:
mode:
authorAlex Early <alexander.early@gmail.com>2018-09-30 17:00:10 -0700
committerGitHub <noreply@github.com>2018-09-30 17:00:10 -0700
commit8aecf108b3922bc5211036706a0f6f75e02bd42b (patch)
tree0f7b6bee315231ef4aefdfbee154822921de231f /lib/internal/parallel.js
parentdf41256f49c9bb3126e035c95aca7860329b6acf (diff)
downloadasync-8aecf108b3922bc5211036706a0f6f75e02bd42b.tar.gz
feat: await-able Async methods (#1572)
* make each and family awaitable * dont pretend they're AsyncFunctions * check errors * ensure function name is preserved somehow * awaitable concat * awaitable detect * awaitable every/filter * awaitable groupBy * awaitable map/mapValues * awaitable reduce * awaitable reject * awaitable some * awaitable transform * awaitable times * awaitable auto * awaitable compose/seq * awaitable whilst/until (lol) * awaitable forever * awaitable parallel/race * awaitable retry * awaitable series (lol) * awaitable tryEach * awaitable waterfall (lol) * lint * cleanup, remove noop and unused internal functions
Diffstat (limited to 'lib/internal/parallel.js')
-rw-r--r--lib/internal/parallel.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/internal/parallel.js b/lib/internal/parallel.js
index 8abf0d1..790b6e8 100644
--- a/lib/internal/parallel.js
+++ b/lib/internal/parallel.js
@@ -1,9 +1,8 @@
import isArrayLike from './isArrayLike';
-import noop from './noop';
import wrapAsync from './wrapAsync';
+import awaitify from './awaitify'
-export default function _parallel(eachfn, tasks, callback) {
- callback = callback || noop;
+export default awaitify((eachfn, tasks, callback) => {
var results = isArrayLike(tasks) ? [] : {};
eachfn(tasks, (task, key, taskCb) => {
@@ -15,4 +14,4 @@ export default function _parallel(eachfn, tasks, callback) {
taskCb(err);
});
}, err => callback(err, results));
-}
+}, 3)