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