import { IterableX } from '../iterablex' ; import { MonoTypeOperatorFunction } from '../../interfaces' ; export class ReverseIterable < TSource > extends IterableX < TSource > { private _source : Iterable < TSource > ; constructor ( source ) { super ( ) ; this . _source = source ; } * [ Symbol . iterator ] ( ) { const results = [ ] as TSource [ ] ; for ( const item of this . _source ) { results . unshift ( item ) ; } yield * results ; } } template TSource returns { MonoTypeOperatorAsyncFunction < TSource > } export function reverse < TSource > ( ) { return function reverseOperatorFunction ( source ) : IterableX < TSource > { return new ReverseIterable < TSource > ( source ) ; } ; }