Closed jangchoe closed 5 years ago
Not for async iterables. Grouping a collection requires to know in advance the elements. You can instead await the async iterable then use the itiriri's sync groupBy
method to achieve this:
(async function () {
const q = (await itiririAsync(generator()).awaitAll()).groubBy((_, i) => Math.floor(i / 3));
q.toArray(); // returns [[1,2,3],[4, 5, 6],[7]]
})();
Do you have plans to have a
group
orchunk
function? Something like: