import { LazyIterator } from './iterator.js'; /** * The enum of which iterator finished first in a zip iterator. */ declare enum ZipDoneType { /** * The first iterator finished first. */ iter1 = 0, /** * The second iterator finished first. */ iter2 = 1 } /** * The return type of a zip iterator. * @member type The type of iterator that finished. * @member value The value returned by the iterator. */ type ZipReturn = { type: ZipDoneType.iter1; value: TReturn1; } | { type: ZipDoneType.iter2; value: TReturn2; }; /** * A lazy iterator that zips two iterators together. */ declare class LazyZipIterator extends LazyIterator<[ T1, T2 ], ZipReturn, [ TNext1, TNext2 ]> { source1: LazyIterator; source2: LazyIterator; constructor(source1: LazyIterator, source2: LazyIterator); next(args: [TNext1, TNext2]): { done: true; value: { readonly type: ZipDoneType.iter1; readonly value: TReturn1; } | { readonly type: ZipDoneType.iter2; readonly value: TReturn2; }; } | { done: false; value: [T1, T2]; }; } /** * A lazy iterator that zips the source iterators, filling in missing values with a fill value. */ declare class LazyZipLongestIterator extends LazyIterator<[T1, T2], [TReturn1, TReturn2], [TNext1, TNext2]> { source1: LazyIterator; source2: LazyIterator; fillValue1: T1; fillValue2: T2; constructor(source1: LazyIterator, source2: LazyIterator, fillValue1: T1, fillValue2: T2); next(args: [TNext1, TNext2]): { done: true; value: [TReturn1, TReturn2]; } | { done: false; value: [T1, T2]; }; } declare module "./iterator" { interface LazyIterator { /** * Creates a lazy iterator that zips the source iterators. * @param other The other iterator to zip with. */ zip(other: LazyIterator): LazyZipIterator; } } declare module "./iterator" { interface LazyIterator { /** * Creates a lazy iterator that zips the source iterators, filling in missing values with a fill value. * @param other The other iterator to zip with. * @param fillThis The value to fill in for the source iterator when it is done. * @param fillOther The value to fill in for the other iterator when it is done. Defaults to `fillThis`. */ zipLongest(other: LazyIterator, fillThis: T, fillOther?: T): LazyZipLongestIterator; /** * Creates a lazy iterator that zips the source iterators, filling in missing values with a fill value. * @param other The other iterator to zip with. * @param fillThis The value to fill in for the source iterator when it is done. * @param fillOther The value to fill in for the other iterator when it is done. Defaults to `fillThis`. */ zipLongest(other: LazyIterator, fillThis: T, fillOther: U): LazyZipLongestIterator; } } export { LazyZipIterator, LazyZipLongestIterator, ZipDoneType, ZipReturn };