Skip to content

Commit

Permalink
Do not use .apply to flatten arrays
Browse files Browse the repository at this point in the history
Function calls can only receive a limited number of arguments.
  • Loading branch information
fkling committed Dec 3, 2018
1 parent 62b12ad commit 9c83c39
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Runner.js
Expand Up @@ -63,10 +63,13 @@ const log = {
};

function concatAll(arrays) {
return arrays.reduce(
(result, array) => (result.push.apply(result, array), result),
[]
);
const result = [];
for (const array of arrays) {
for (const element of array) {
result.push(element);
}
}
return result;
}

function showFileStats(fileStats) {
Expand Down

0 comments on commit 9c83c39

Please sign in to comment.