const pipe = (...fxs) => x => fxs.reduce((v, f) => f(v), x);
If you're going to pull in ramda for example, they have their own pipe, and a map function that takes (predicate, array) as curried arguments, to aid with composition
import { map, pipe, range, sum } from 'ramda'; pipe(
range,
map(i => i * i),
sum
)(0, 6)
I haven't messed with HN formatting before, so I hope that turns out right. My team uses Ramda and pipes regularly in our Node code, and its absolutely wonderful
"I always used to get some compilation errors which were hard to understand initially, and I scratched my head trying to figure out the problem. "
Which is like saying, "I got rid of my carbon monoxide detector because it kept beeping at me"