import type { F } from 'ts-toolbelt' ; import type { A } from 'ts-toolbelt' ; import { skip } from './transduce' ; function pipeSync ( fn , ... fns ) { return ( ... args ) => { let result = fn ( ... args ) ; for ( let i = 0 ; result !== skip && i < fns . length ; ++ i ) { result = fns [ i ] ( result ) ; } return result ; } ; } function pipeAsync ( fn , ... fns ) { return async ( ... args ) => { let result = await fn ( ... args ) ; for ( let i = 0 ; result !== skip && i < fns . length ; ++ i ) { result = await fns [ i ] ( result ) ; } return result ; } ; } param fn param fns returns const pipe = pipeSync as PipeMultiSync & { async : PipeMultiAsync ; } ; pipe . async = pipeAsync ; export declare type PipeMultiSync = { < R0 , P extends any [ ] > ( ... fns ) : F . Function < P , R0 > ; < R0 , R1 , P extends any [ ] > ( ... fns ) : F . Function < P , R1 > ; < R0 , R1 , R2 , P extends any [ ] > ( ... fns ) : F . Function < P , R2 > ; < R0 , R1 , R2 , R3 , P extends any [ ] > ( ... fns ) : F . Function < P , R3 > ; < R0 , R1 , R2 , R3 , R4 , P extends any [ ] > ( ... fns ) : F . Function < P , R4 > ; < R0 , R1 , R2 , R3 , R4 , R5 , P extends any [ ] > ( ... fns ) : F . Function < P , R5 > ; < R0 , R1 , R2 , R3 , R4 , R5 , R6 , P extends any [ ] > ( ... fns ) : F . Function < P , R6 > ; < R0 , R1 , R2 , R3 , R4 , R5 , R6 , R7 , P extends any [ ] > ( ... fns ) : F . Function < P , R7 > ; < R0 , R1 , R2 , R3 , R4 , R5 , R6 , R7 , R8 , P extends any [ ] > ( ... fns ) : F . Function < P , R8 > ; < R0 , R1 , R2 , R3 , R4 , R5 , R6 , R7 , R8 , R9 , P extends any [ ] > ( ... fns ) : F . Function < P , R9 > ; } ; export declare type PipeMultiAsync = { < R0 , P extends any [ ] > ( ... fns ) : F . Function < P , Promise < A . Await < R0 > > > ; < R0 , R1 , P extends any [ ] > ( ... fns ) : F . Function < P , Promise < A . Await < R1 > > > ; < R0 , R1 , R2 , P extends any [ ] > ( ... fns ) : F . Function < P , Promise < A . Await < R2 > > > ; < R0 , R1 , R2 , R3 , P extends any [ ] > ( ... fns ) : F . Function < P , Promise < A . Await < R3 > > > ; < R0 , R1 , R2 , R3 , R4 , P extends any [ ] > ( ... fns ) : F . Function < P , Promise < A . Await < R4 > > > ; < R0 , R1 , R2 , R3 , R4 , R5 , P extends any [ ] > ( ... fns ) : F . Function < P , Promise < A . Await < R5 > > > ; < R0 , R1 , R2 , R3 , R4 , R5 , R6 , P extends any [ ] > ( ... fns ) : F . Function < P , Promise < A . Await < R6 > > > ; < R0 , R1 , R2 , R3 , R4 , R5 , R6 , R7 , P extends any [ ] > ( ... fns ) : F . Function < P , Promise < A . Await < R7 > > > ; < R0 , R1 , R2 , R3 , R4 , R5 , R6 , R7 , R8 , P extends any [ ] > ( ... fns ) : F . Function < P , Promise < A . Await < R8 > > > ; < R0 , R1 , R2 , R3 , R4 , R5 , R6 , R7 , R8 , R9 , P extends any [ ] > ( ... fns ) : F . Function < P , Promise < A . Await < R9 > > > ; } ; export { pipe } ;