Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 520 Bytes

chunk.md

File metadata and controls

33 lines (21 loc) · 520 Bytes

arrays.chunk

chunk(array, [size=1])

Splits the input array up into an subset arrays of equal size

Arguments

  1. array (Array): input array
  2. [size=1] (number): size of each chunk

Returns

(Array): array of chunk arrays

Example

const result = arrays.chunk([1, 2, 3, 4, 5], 2);
console.log(result);
> [[1, 2], [3, 4], [5]]