Guest User

Untitled

a guest
Aug 28th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. const pipe = (...fns) => x => fns.reduce((v, f) => f(v), x);
  2.  
  3. const fn1 = s => s.toLowerCase();
  4. const fn2 = s => s.split('').reverse().join('');
  5. const fn3 = s => s + '!'
  6.  
  7. const newFunc = pipe(fn1, fn2, fn3);
  8. const result = newFunc('Time'); // emit!
Add Comment
Please, Sign In to add comment