/*!
 * @techmely/utils
 * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com>
 * MIT Licensed
 */


// src/chunkArray.ts
function chunk(array, size = 1) {
  if (!array || array.length === 0) {
    return [];
  }
  const chunkLength = Math.ceil(array.length / size);
  return Array.from({ length: chunkLength }, (_v, i) => {
    const start = i * size;
    return array.slice(start, start + size);
  });
}

export { chunk };
