JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr{ gilour

File "chunk-array.ts"

Full Path: /home/markqprx/iniasli.pro/resources/client/utils/array/chunk-array.ts
File size: 340 bytes
MIME-type: text/plain
Charset: utf-8

export function chunkArray<T>(array: T[], chunkSize: number): T[][] {
  return array.reduce<any>((resultArray, item, index) => {
    const chunkIndex = Math.floor(index / chunkSize);

    if (!resultArray[chunkIndex]) {
      resultArray[chunkIndex] = [];
    }

    resultArray[chunkIndex].push(item);

    return resultArray;
  }, []);
}