Splits the given array values into groups of a given size.
Syntax
import { chunk } from '@opentf/std';
chunk(arr: unknown[], size = 1): unknown[];
Examples
chunk([1, 2, 3]) //=> [[1], [2], [3]]
chunk([1, 2, 3], 1) //=> [[1], [2], [3]]
chunk([1, 2, 3], 2) //=> [[1, 2], [3]]
chunk([1, 2, 3], 3) //=> [[1, 2, 3]]
chunk([1, 2, 3], 4) //=> [[1, 2, 3]]