Try out pipe and tap. pipe takes an array of functions and lets you chain them together so that the return value of one function becomes the first argument to the next. tap takes a function and some input, calls the function with input, and returns the original input (good for effects). Both of these functions used together can get you started composing functions pretty fast. Here are some implementations for the functions.
Try out
pipe
andtap
.pipe
takes an array of functions and lets you chain them together so that the return value of one function becomes the first argument to the next.tap
takes a function and some input, calls the function with input, and returns the original input (good for effects). Both of these functions used together can get you started composing functions pretty fast. Here are some implementations for the functions.Example with
pipe
,tap
,map
, andfilter
I created a library with async-capable versions of the above and more. Check it out at rubico.land