Function slice

  • Works like Array.prototype.slice, returns a new slice of this iterator.

    Type Parameters

    Parameters

    • arg: T

      The input iterator to slice.

    • start: number

      The index to start at (inclusive).

    • Optionalend: number

      The index to end at (exclusive).

    Returns IterableIterator<IterSource<T>>

    A new iterator that only includes the elements between start and end.

    This does not support negative start and end indices, as it's not possible to know the length of the iterator while iterating.

  • Type Parameters

    Parameters

    • start: number
    • Optionalend: number

    Returns ((arg: T) => IterableIterator<IterSource<T>>)