summaryrefslogtreecommitdiff
path: root/lib/eachOf.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/eachOf.js')
-rw-r--r--lib/eachOf.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/eachOf.js b/lib/eachOf.js
index f3bda13..bb12235 100644
--- a/lib/eachOf.js
+++ b/lib/eachOf.js
@@ -1,7 +1,6 @@
import isArrayLike from './internal/isArrayLike';
import breakLoop from './internal/breakLoop';
import eachOfLimit from './eachOfLimit';
-import doLimit from './internal/doLimit';
import noop from './internal/noop';
import once from './internal/once';
import onlyOnce from './internal/onlyOnce';
@@ -37,7 +36,9 @@ function eachOfArrayLike(coll, iteratee, callback) {
}
// a generic version of eachOf which can handle array, object, and iterator cases.
-var eachOfGeneric = doLimit(eachOfLimit, Infinity);
+function eachOfGeneric (coll, iteratee, callback) {
+ return eachOfLimit(coll, Infinity, iteratee, callback);
+}
/**
* Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument
@@ -79,7 +80,9 @@ var eachOfGeneric = doLimit(eachOfLimit, Infinity);
* doSomethingWith(configs);
* });
*/
-export default awaitify((coll, iteratee, callback) => {
+function eachOf(coll, iteratee, callback) {
var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric;
- eachOfImplementation(coll, wrapAsync(iteratee), callback);
-}, 3)
+ return eachOfImplementation(coll, wrapAsync(iteratee), callback);
+}
+
+export default awaitify(eachOf, 3)