diff --git a/lib/util.js b/lib/util.js index 8bd5871..0c96d04 100644 --- a/lib/util.js +++ b/lib/util.js @@ -50,13 +50,9 @@ class Util { * Splits a list into a list of lists each with maximum length LIMIT */ static splitList(list, limit) { - if (list.length <= limit) - return [list] - const lists = [] - while (list.length) { - lists.push(list.splice(0, limit)) - } + for (let i=0; i < list.length; i += limit) + lists.push(list.slice(i, i+limit)) return lists }