1.0.0 • Published 3 years ago
jsmp-infra-volodymyr-smoliar-array-chunker v1.0.0
array-chunker
Array chunker is a small module that creates an array of elements split into groups the length of size. If array can't be split evently, the final chunk will be the remaining elements.
Arguments
array (Array): The array to process. size=1: The length of each chunk
Returns
(Array): Returns the new array of chunks.
Example
chunk(['a', 'b', 'c', 'd'], 2);
// => [['a', 'b'], ['c', 'd']]
chunk(['a', 'b', 'c', 'd'], 3);
// => [['a', 'b', 'c'], ['d']]1.0.0
3 years ago