Initial commit

This commit is contained in:
Luka Romih
2022-12-07 04:43:36 +01:00
commit 257f3c354f
496 changed files with 55373 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
const utils = {}
utils.compose = (...fns) => (initialVal) => fns.reduceRight((val, fn) => fn(val), initialVal)
utils.pipe = (...fns) => (initialVal) => fns.reduce((val, fn) => fn(val), initialVal)
utils.composeAsync = (...fns) => input => fns.reduceRight((chain, func) => chain.then(func), Promise.resolve(input));
utils.pipeAsync = (...fns) => input => fns.reduce((chain, func) => chain.then(func), Promise.resolve(input));
module.exports = utils