-
Notifications
You must be signed in to change notification settings - Fork 5
chunk
wolfram77 edited this page Apr 13, 2020
·
22 revisions
Breaks array into chunks of given size. [:running:] [:vhs:] [:package:] [:moon:]
array.chunk(x, [n]);
// x: an array
// n: chunk size (1)
// --> chunks
const array = require('extra-array');
var x = [1, 2, 3, 4, 5];
array.chunk(x, 2);
// [ [ 1, 2 ], [ 3, 4 ], [ 5 ] ]
array.chunk(x, 3);
// [ [ 1, 2, 3 ], [ 4, 5 ] ]
- _.chunk: lodash
- even-chunks: @addaleax
- chunk: @ryancole
- array.chunk: @zhiyelee
- chunk-array: @haio
- array_chunk: PHP
- List-Extra.groupsOf(): elm [:running:]: https://npm.runkit.com/@extra-array/chunk [:package:]: https://www.npmjs.com/package/@extra-array/chunk [:moon:]: https://www.npmjs.com/package/@extra-array/chunk.min [:vhs:]: https://asciinema.org/a/319333