barbiturat
7/30/2017 - 9:01 PM

Pass multiple arguments to functions composition

Pass multiple arguments to functions composition

const fn = (a, b, c) => a + b + c;

const composeMulti = (...funcs) => (...args) => 
  reduce((as, currFn) => 
    update(0, apply(currFn, as), as), 
  args, funcs)

composeMulti(fn, toUpper, fn)('a', 'b', 'c', 'd', 'e') //=> ["ABCbc", "b", "c", "d", "e"]