UNPKG

fn-pipe

Version:

Pipe function for function composition

8 lines 184 B
export const pipe = (...fns) => data => fns.reduce((acc, fn) => { if(typeof acc.then === 'function'){ return acc.then(fn) } else { return fn(acc) } }, data)