farcasmihai91
4/25/2018 - 7:39 AM

ES6 - Pipe Implemnetation

Functional programming - piping functions

pipe = (...fns) => x => fns.reduce((v, f) => f(v), x)

// example usage
// pipe(
//   getName,
//   uppercase,
//   get6Characters,
//   reverse 
// )({ name: 'Buckethead' })
// => 'TEKCUB'