@canvasgfx/chunks
v1.0.3
Published
Creates an array of elements split into groups the length of size.
Downloads
87
Readme
What is Chunks?
Chunks is a TypeScript library that creates an array of elements split into groups the length of size. If the array can't be split evenly, the final chunk can be optionally padded with a default value.
Installation
To get started, install the package from npm.
npm install --save @reactgular/chunks
Usage
Chunks is small, simple and easy to use.
import {chunks} from '@reactgular/chunks';
console.log(chunks([1,2,3,4,5],2))
// => [[1,2],[3,4],[5]]
console.log(chunks([1,2,3,4,5],2,undefined))
// => [[1,2],[3,4],[5,undefined]]
Getting help
You are welcome to open issues for general support questions as well as bug reports and feature requests.