froebel
Version:
TypeScript utility library
14 lines (13 loc) • 375 B
TypeScript
/**
* Takes a `list` and returns it in multiple smaller lists of the size
* `batchSize`.
* The last batch may be smaller than `batchSize` depending on if `list` size is
* divisible by `batchSize`.
*
* @example
* ```
* batch([1,2,3,4,5], 2) // -> [ [1,2], [3,4], [5] ]
* ```
*/
declare const batch: <T>(list: T[], batchSize: number) => T[][];
export default batch;