summaryrefslogtreecommitdiff
path: root/lib/concatLimit.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/concatLimit.js')
-rw-r--r--lib/concatLimit.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/concatLimit.js b/lib/concatLimit.js
index cec4e2b..e5c179a 100644
--- a/lib/concatLimit.js
+++ b/lib/concatLimit.js
@@ -1,10 +1,7 @@
import noop from './internal/noop';
import wrapAsync from './internal/wrapAsync';
-import slice from './internal/slice';
import mapLimit from './mapLimit';
-var _concat = Array.prototype.concat;
-
/**
* The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time.
*
@@ -26,16 +23,16 @@ var _concat = Array.prototype.concat;
export default function(coll, limit, iteratee, callback) {
callback = callback || noop;
var _iteratee = wrapAsync(iteratee);
- mapLimit(coll, limit, function(val, callback) {
- _iteratee(val, function(err /*, ...args*/) {
+ mapLimit(coll, limit, (val, callback) => {
+ _iteratee(val, (err, ...args) => {
if (err) return callback(err);
- return callback(null, slice(arguments, 1));
+ return callback(null, args);
});
- }, function(err, mapResults) {
+ }, (err, mapResults) => {
var result = [];
for (var i = 0; i < mapResults.length; i++) {
if (mapResults[i]) {
- result = _concat.apply(result, mapResults[i]);
+ result = result.concat(...mapResults[i]);
}
}