array-chunk

Chunk array on small pieces

Usage no npm install needed!

<script type="module">
  import arrayChunk from 'https://cdn.skypack.dev/array-chunk';
</script>

README

array-chunk

Chunk array on small pieces

Install

$ npm install --save array-chunk

Usage

var arrayChunk = require('array-chunk');

arrayChunk([1, 2, 3, 4], 2);
//=> [[1, 2], [3, 4]]

API

arrayChunk(arr, size)

arr

Required Type: array | TypedArray

Your array

size

Required Type: number

Length of nested array , default 1

Related

License

MIT © hzlmn