1.0.0 • Published 7 years ago
@ngard/tiny-chunk v1.0.0
tiny-chunk
A minimal-weight utility similar to lodash.chunk. For when every byte counts!
The only difference is that tiny-chunk has a minimum chunk size of 1 instead of 0.
Syntax
chunk(/* array [, chunkSize] */)Parameters
array - An array to chunk
chunkSize - optional A positive numerical value that designates the size of the chunks to be created. Non-numeric values will default to 1. Non-integer values will round down to the nearest integer.
Return
An array of elements split into groups the length of chunkSize. If the array can't be split evenly, the final chunk will be the remaining elements.
Example
import { chunk } from '@ngard/tiny-chunk';
const value = chunk([1, 2, 3, 4, 5], 2);
// value is [[1, 2], [3, 4], [5]]1.0.0
7 years ago