@jswork/next-chunk

1.0.3 • Public • Published

next-chunk

Creates an array of elements split into groups the length of size.

version license size download

installation

npm install -S @jswork/next-chunk

apis

api type description
nx.chunk (inArray,inChunk) Create split chunks

usage

import '@jswork/next-chunk';

// array
const arr = [1,2,3,4,5,6,7,8];
const res = nx.chunk(arr, 3);
// result:
// [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8 ] ]


// buffer/file
const file =new File(["foobar"], "foo.txt", {
  type: "text/plain",
});

// result:
const res = nx.chunk(file, 2);
// [ Blob, Blob, Blob ] 

license

Code released under the MIT license.

Package Sidebar

Install

npm i @jswork/next-chunk

Weekly Downloads

4

Version

1.0.3

License

MIT

Unpacked Size

5.36 kB

Total Files

6

Last publish

Collaborators

  • afeiship