• Distributes arg among n amount of smaller iterators. Does not maintain order so if order is important, use divide instead.

    Type Parameters

    • T
    • Size extends number

    Parameters

    Returns Tuple<IterableIterator<T, any, any>, Size>

    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]]
  • Distributes arg among n amount of smaller iterators. Does not maintain order so if order is important, use divide instead.

    Type Parameters

    • T
    • Size extends number

    Parameters

    Returns (arg: IteratorOrIterable<T>) => Tuple<IterableIterator<T, any, any>, Size>

    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]]