@kev_nz/async-tools
Version:
Async tools - a collection of utility functions for working with async/await code.
20 lines (19 loc) • 375 B
JavaScript
const reducer = require('./reducer')
/**
* Composer
*
* @param {*} funcs - The cunctions to chain
* @returns a function chain
*
* @example
*
* const asyncChain = composer(
* anAsyncFunction,
* anotherAsyncFunction,
* anAsyncFunction
* )
* const finalValue = await asyncChain(0)
*/
module.exports = (...funcs) => {
return val => reducer(val, ...funcs)
}