2018-06-11 20:36:32 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
value: true
|
|
|
|
});
|
|
|
|
exports.createGroupedList = void 0;
|
|
|
|
|
|
|
|
var createGroupedList = function createGroupedList(list, size) {
|
2018-06-14 22:06:19 +02:00
|
|
|
if (!size) {
|
|
|
|
throw new Error('no size provided to createGroupedList');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!list) {
|
|
|
|
throw new Error('no list provided to createGroupedList');
|
|
|
|
}
|
|
|
|
|
2018-06-11 20:36:32 +02:00
|
|
|
var groupedList = [];
|
|
|
|
|
2018-06-14 22:06:19 +02:00
|
|
|
for (var i = 0; i < list.length; i = i + size) {
|
|
|
|
var group = [];
|
|
|
|
|
|
|
|
for (var j = i; j < i + size; j++) {
|
|
|
|
group.push(list[j]);
|
|
|
|
}
|
|
|
|
|
|
|
|
groupedList.push(group);
|
2018-06-11 20:36:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return groupedList;
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.createGroupedList = createGroupedList;
|