DEV Community

Discussion on: Can you help me to improve my Functional Programming skills?

Collapse
 
pradosh987 profile image
Pradosh Gaonkar

Oh Okay, you know you can implement something like flow, this is just POC and not tested either

export const flow = (methods: Function[]) => {
  return function(...args) {
    return methods
      .slice(1, methods.length)
      .reduce((acc, method) => method(acc), methods[0](args));
  };
};
Thread Thread
 
adancarrasco profile image
Adán Carrasco

This is really cool! Thanks for sharing! 💪🏽💪🏽