UNPKG

background-process-js

Version:
14 lines (13 loc) 436 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.splitArrayInChunks = void 0; const splitArrayInChunks = (array, size) => { if (size <= 0) throw new Error("Size must be greater than zero"); const result = []; for (let i = 0; i < array.length; i += size) { result.push(array.slice(i, i + size)); } return result; }; exports.splitArrayInChunks = splitArrayInChunks;