1 | const mixCompose = (chain, func) => (chain instanceof Promise || typeof chain.then === "function") ? chain.then(func) : func(chain);
|
2 |
|
3 | const pipe = (...fn) => input => fn.reduce(mixCompose,input);
|
4 | const compose = (...fn) => input => fn.reduceRight(mixCompose,input);
|
5 |
|
6 | module.exports = {pipe, compose};
|