I think many developers would appreciate having the pipeline operator to make code neater, more concise and easier to debug. It is currently an ECMA TC39 Stage 1 proposal.
For those who are unfamiliar with the pipeline operator |>, here is an example. Given the following functions:
//With official Javascript syntax
const result = exclaim(capitalize(doubleSay("hello")));
result //=> "Hello, hello!"
//With pipeline operator
const result = "hello"
|> doubleSay
|> capitalize
|> exclaim;
result //=> "Hello, hello!"
There are currently three variants of the pipeline operator that can be enabled:
"minimal" – Minimal Pipeline
"smart" - Smart Pipeline
"fsharp" - F#-Style Pipeline
The minimal variant would be a poor choice because it does not support the await keyword for asynchronous code.
I consider the fsharp variant to be preferable to the smart variant because of its clearer syntax. Having read some community discussion, other people seem to be leaning towards it.
I think many developers would appreciate having the pipeline operator to make code neater, more concise and easier to debug. It is currently an ECMA TC39 Stage 1 proposal.
For those who are unfamiliar with the pipeline operator |>, here is an example. Given the following functions:
The following invocations are equivalent:
There are currently three variants of the pipeline operator that can be enabled:
The minimal variant would be a poor choice because it does not support the await keyword for asynchronous code.
I consider the fsharp variant to be preferable to the smart variant because of its clearer syntax. Having read some community discussion, other people seem to be leaning towards it.
See these links:
https://babeljs.io/docs/en/babel-plugin-proposal-pipeline-operator https://github.com/valtech-nyc/proposal-fsharp-pipelines