import { OperatorFunction } from '../interfaces' ; import { IterableX } from './iterablex' ; import { from } from './from' ; export function pipe < T > ( source ) ; export function pipe < T , A > ( source , op1 ) ; export function pipe < T , A , B > ( source , op1 , op2 ) ; export function pipe < T , A , B , C > ( source , op1 , op2 , op3 ) ; export function pipe < T , A , B , C , D > ( source , op1 , op2 , op3 , op4 ) ; export function pipe < T , A , B , C , D , E > ( source , op1 , op2 , op3 , op4 , op5 ) ; export function pipe < T , A , B , C , D , E , F > ( source , op1 , op2 , op3 , op4 , op5 , op6 ) ; export function pipe < T , A , B , C , D , E , F , G > ( source , op1 , op2 , op3 , op4 , op5 , op6 , op7 ) ; export function pipe < T , A , B , C , D , E , F , G , H > ( source , op1 , op2 , op3 , op4 , op5 , op6 , op7 , op8 ) ; export function pipe < T , A , B , C , D , E , F , G , H , I > ( source , op1 , op2 , op3 , op4 , op5 , op6 , op7 , op8 , op9 ) ; export function pipe < TSource , TResult > ( source , ... operations ) { if ( operations . length === 0 ) { return source instanceof IterableX ? source : from ( source ) ; } const piped = ( input ) : IterableX < TResult > => { return operations . reduce ( ( prev , fn ) => fn ( prev ) , input as any ) ; } ; return piped ( source ) ; }