UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

12 lines 694 B
import type { IteratorOrIterable, Tuple } from './types'; /** * Distributes `arg` among `n` amount of smaller iterators. Does not maintain order so if order is important, use * `divide` instead. * @example * distribute(range(3), 3)].map(v => toArray(v)); // [[0], [1], [2]], * distribute(range(6), 2)].map(v => toArray(v)); // [[0, 2, 4], [1, 3, 5]] */ export declare function distribute<T, Size extends number>(arg: IteratorOrIterable<T>, n: Size): Tuple<IterableIterator<T>, Size>; export declare function distribute<T, Size extends number>(n: Size): (arg: IteratorOrIterable<T>) => Tuple<IterableIterator<T>, Size>; export default distribute; //# sourceMappingURL=distribute.d.ts.map