function chunkArray (arr, chunkSize) {
  const result = []
  for (let i = 0; i < arr.length; i += chunkSize) {
    result.push(arr.slice(i, i + chunkSize))
  }
  return result
}
Helper to split an array into chunks
@param {any[]} arr 
@param {Number} chunkSize 
@returns {Array<any[]>}