0.1.0 • Published 3 years ago

js-chunked-array v0.1.0

Weekly downloads
-
License
Unlicense
Repository
-
Last release
3 years ago

js-chunked-array

This creates an iterable wrapper for an Array or Array-like object.
The Chunks are not generated on initialisation, but are available through the iterator.
Usage:

const chunked = new ChunkedArray(originalArray, sizeOfChunks);
chunked.next() // { value: first chunk, done: true when no chunks left}

The chunkedArray is iterable and can be used in for..of or with the ... spread operator

for (let chunk in chunked) {
    // do sometihng with each chunk
}
const allChunks = [...chunked];