Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const pipe = (...fns) => x => fns.reduce((v, f) => f(v), x);
- const fn1 = s => s.toLowerCase();
- const fn2 = s => s.split('').reverse().join('');
- const fn3 = s => s + '!'
- const newFunc = pipe(fn1, fn2, fn3);
- const result = newFunc('Time'); // emit!
Add Comment
Please, Sign In to add comment