summaryrefslogtreecommitdiff
path: root/lib/concatLimit.js
diff options
context:
space:
mode:
authorHubert Argasinski <argasinski.hubert@gmail.com>2017-06-10 23:15:25 -0400
committerGitHub <noreply@github.com>2017-06-10 23:15:25 -0400
commit9c23239a2088fbf69cd2da44755c9cfd663590b4 (patch)
treeecfd177c167f60abf107715ca4bb2d8925f86d31 /lib/concatLimit.js
parent0364ff3ac9727b69aefaab25999a491c8fa34fcd (diff)
downloadasync-9c23239a2088fbf69cd2da44755c9cfd663590b4.tar.gz
add concatLimit [fixes #1426] (#1430)
Diffstat (limited to 'lib/concatLimit.js')
-rw-r--r--lib/concatLimit.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/concatLimit.js b/lib/concatLimit.js
new file mode 100644
index 0000000..a86fd74
--- /dev/null
+++ b/lib/concatLimit.js
@@ -0,0 +1,22 @@
+import doParallelLimit from './internal/doParallelLimit';
+import concat from './internal/concat';
+
+/**
+ * The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time.
+ *
+ * @name concatLimit
+ * @static
+ * @memberOf module:Collections
+ * @method
+ * @see [async.concat]{@link module:Collections.concat}
+ * @category Collection
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
+ * @param {number} limit - The maximum number of async operations at a time.
+ * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
+ * which should use an array as its result. Invoked with (item, callback).
+ * @param {Function} [callback(err)] - A callback which is called after all the
+ * `iteratee` functions have finished, or an error occurs. Results is an array
+ * containing the concatenated results of the `iteratee` function. Invoked with
+ * (err, results).
+ */
+export default doParallelLimit(concat);