import { chunked } from "https://deno.land/x/itertools@v1.1.1/more-itertools.ts";
Break iterable into lists of length size
:
[...chunked([1, 2, 3, 4, 5, 6], 3)]
// [[1, 2, 3], [4, 5, 6]]
If the length of iterable is not evenly divisible by size
, the last returned
list will be shorter:
[...chunked([1, 2, 3, 4, 5, 6, 7, 8], 3)]
// [[1, 2, 3], [4, 5, 6], [7, 8]]
Parameters
iterable: Iterable<T>