import { IterableX } from '../iterablex' ; import { MonoTypeOperatorFunction } from '../../interfaces' ; export class SkipLastIterable < TSource > extends IterableX < TSource > { private _source : Iterable < TSource > ; private _count : number ; constructor ( source , count ) { super ( ) ; this . _source = source ; this . _count = count ; } * [ Symbol . iterator ] ( ) { const q = [ ] as TSource [ ] ; for ( const item of this . _source ) { q . push ( item ) ; if ( q . length > this . _count ) { yield q . shift ( ) ! ; } } } } template TSource param { number } count returns { MonoTypeOperatorFunction < TSource > } export function skipLast < TSource > ( count ) { return function skipLastOperatorFunction ( source ) : IterableX < TSource > { return new SkipLastIterable < TSource > ( source , count ) ; } ; }