Breaks an array into chunks of size chunkSize.
chunkSize
The last chunk may contain less than chunkSize items.
the array to chunk
a positive integer
an array of arrays
Chunk into groups of 2.
import { chunkEvery } from "@trashpanda001/helpers/array"chunkEvery([1, 2, 3, 4, 5], 2)// [[1, 2], [3, 4], [5]] Copy
import { chunkEvery } from "@trashpanda001/helpers/array"chunkEvery([1, 2, 3, 4, 5], 2)// [[1, 2], [3, 4], [5]]
Breaks an array into chunks of size
chunkSize
.The last chunk may contain less than
chunkSize
items.