I got composable to work the same as pipe: multiple initial arguments.
export function compose<R, F extends (a: R, ...b: any) => R>( fn1: F, ...fns: Array<(a: R) => R> ) { return fns.reduce( (prevFn, nextFn) => value => prevFn(nextFn(value)), fn1 ) as F; } const a = (v: string, q: number, s: boolean) => v + q; const b = (v: string) => v; const c = compose(a, b, b, b, b, b, b);
I can say that I've been wanting to find this post for at least a year!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I got composable to work the same as pipe: multiple initial arguments.
I can say that I've been wanting to find this post for at least a year!