UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

14 lines 859 B
import type { IterSource, IteratorOrIterable } from './types'; /** * Works like `Array.prototype.slice`, returns a new slice of this iterator. * @note This does not support negative `start` and `end` indices, as it's not possible to know the length of the * iterator while iterating. * @param arg The input iterator to slice. * @param start The index to start at (inclusive). * @param end The index to end at (exclusive). * @returns A new iterator that only includes the elements between `start` and `end`. */ export declare function slice<T extends IteratorOrIterable<unknown>>(arg: T, start: number, end?: number): IterableIterator<IterSource<T>>; export declare function slice<T extends IteratorOrIterable<unknown>>(start: number, end?: number): (arg: T) => IterableIterator<IterSource<T>>; export default slice; //# sourceMappingURL=slice.d.ts.map