import { comparer as defaultComparer } from '../util/comparer' ; interface template T export interface SequencEqualOptions < T > { memberof comparer ? : ( first : T , second : T ) => boolean ; } template T param { Iterable < T > } source param { Iterable < T > } other param { SequencEqualOptions < T > } options returns { boolean } export function sequenceEqual < T > ( source , other , options ? ) { const { [ 'comparer' ] : comparer = defaultComparer } = options || { } ; const it1 = source [ Symbol . iterator ] ( ) ; const it2 = other [ Symbol . iterator ] ( ) ; let next1 ; let next2 ; while ( ! ( next1 = it1 . next ( ) ) . done ) { if ( ! ( ! ( next2 = it2 . next ( ) ) . done && comparer ( next1 . value , next2 . value ) ) ) { return false ; } } return ! ! it2 . next ( ) . done ; }