splitArrayByLength

Function

Splits a single array into many arrays of a given max length. E.g. splitArrayByLength(['a', 'b', 'c'], 2); // => [['a', 'b'], ['c']]

  • splitArrayByLength(originalValues: [], length: number) : [][]

Parameters

Parameter Type Default Notes
originalValues Required []

The original array of values

length Required number

The max length of the resulting arrays

Returns

an array of arrays

[][]

Function defined in common/src/utils/_array.ts:21