diff options
author | Alexander Early <alexander.early@gmail.com> | 2017-04-02 22:53:16 -0700 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2017-04-02 22:53:16 -0700 |
commit | 2030f5f1bd01a141ac4c85d3deab927f49e255fc (patch) | |
tree | 96bbf0235a99b519854e24a3e411921ec5f384fd /lib/internal/eachOfLimit.js | |
parent | 216d2844e667cccd449824d8fdcc5f76335972a5 (diff) | |
download | async-2030f5f1bd01a141ac4c85d3deab927f49e255fc.tar.gz |
initial experiment with returning promises
Diffstat (limited to 'lib/internal/eachOfLimit.js')
-rw-r--r-- | lib/internal/eachOfLimit.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/internal/eachOfLimit.js b/lib/internal/eachOfLimit.js index da46fa4..487ec3f 100644 --- a/lib/internal/eachOfLimit.js +++ b/lib/internal/eachOfLimit.js @@ -1,14 +1,14 @@ -import noop from 'lodash/noop'; import once from './once'; import iterator from './iterator'; import onlyOnce from './onlyOnce'; import breakLoop from './breakLoop'; +import promiseCallback from './promiseCallback'; export default function _eachOfLimit(limit) { return function (obj, iteratee, callback) { - callback = once(callback || noop); + callback = once(callback || promiseCallback()); if (limit <= 0 || !obj) { return callback(null); } @@ -47,5 +47,6 @@ export default function _eachOfLimit(limit) { } replenish(); + return callback.promise; }; } |