DEV Community

loading...

Discussion on: I made a JS Module so you can *almost* use the pipeline operator today!

Collapse
1hko profile image
1hko

Nice work. This sort of exercise is great because it shows us that syntax is often nothing other than sugar. Everything is possible with lambda.

Another encoding that allows you to chain any amount of functions

const pipeline = x => f =>
  pipeline (f (x))

pipeline ("hello") (doubleSay) (capitalize) (exclaim) (console.log)
// Hello, hello!

pipeline ("hello") (exclaim) (exclaim) (exclaim) (exclaim) (console.log)
// hello!!!!