static batch(array, size) {
    let res = []
    for (let element of array) {
      let batch = res[res.length-1]
      if (!batch || batch.length >= size) {
        res.push(batch = [])
      }
      batch.push(element)
    }
    return res
  }
/**
   * Make batches from an array and a batch size
   */
Make batches from an array and a batch size
Make batches from an array and a batch size
static batch(array, size) {
    let res = []
    for (let element of array) {
      let batch = res[res.length-1]
      if (!batch || batch.length >= size) {
        res.push(batch = [])
      }
      batch.push(element)
    }
    return res
  }
static batch ( array , size ) { let res = [ ] for ( let element of array ) { let batch = res [ res . length - 1 ] if ( ! batch || batch . length >= size ) { res . push ( batch = [ ] ) } batch . push ( element ) } return res }
Make batches from an array and a batch size
Make batches from an array and a batch size