* Create a function that chains multiple functions together. The
* functions are called in order. Each function takes the result of
* the previous function as its first argument.
* const myChainedFunc = chain(
* myChainedFunc(0) // => 10
export function chain < T1 extends any [] , T2 , T3 > (
export function chain < T1 extends any [] , T2 , T3 , T4 > (
export function chain < T1 extends any [] , T2 , T3 , T4 , T5 > (
export function chain < T1 extends any [] , T2 , T3 , T4 , T5 , T6 > (
export function chain < T1 extends any [] , T2 , T3 , T4 , T5 , T6 , T7 > (
export function chain < T1 extends any [] , T2 , T3 , T4 , T5 , T6 , T7 , T8 > (
export function chain < T1 extends any [] , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 > (
export function chain < T1 extends any [] , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 > (
export function chain ( ... funcs : ( ( ... args : any [] ) => any )[] ) {
return ( ... args : any [] ) => {
return funcs . slice ( 1 ) . reduce ( ( acc , fn ) => fn ( acc ) , funcs [ 0 ]( ... args ));