Functional composition helpers.
Install
yarn add funcom
API
compose
Sequential composition of functions invoked in reverse order. Passes return value of the previous function as an argument to the next one.
console.log composed2// (2 + 4) * 2 => 12
composeAsync
console.log await composed2// (2 + 4) * 2 => 12
pipe
Sequential composition of functions invoked in direct order. Passes return value of the previous function as an argument to the next one.
console.log piped2// (2 * 2) + 4 => 8
pipeAsync
console.log await piped2// (2 * 2) + 4 => 8
all
Composition of multiple functions invoked with same initial value. Returns an array of results.
console.log piped2// [8, 6, '2']
allAsync
console.log await piped2// [8, 6, '2']