import { IIterator , iter , IterableOrArrayLike } from './iter' ; param objects returns export function zip < T > ( ... objects ) { return new ZipIterator < T > ( objects . map ( iter ) ) ; } /**
 * An iterator which iterates several sources in lockstep.
 */ export class ZipIterator < T > implements IIterator < T [ ] > { param source constructor ( source ) { this . _source = source ; } returns iter ( ) { return this ; } returns clone ( ) { return new ZipIterator < T > ( this . _source . map ( it => it . clone ( ) ) ) ; } returns next ( ) { let result = new Array < T > ( this . _source . length ) ; for ( let i = 0 , n = this . _source . length ; i < n ; ++ i ) { let value = this . _source [ i ] . next ( ) ; if ( value === undefined ) { return undefined ; } result [ i ] = value ; } return result ; } private _source : IIterator < T > [ ] ; }