Babel’s online demo is…unintuitive. I’m trying to use it to test out the pipeline operator proposals for ECMAScript. I thought it would be as simple as selecting the proper plugins, but no. I have two configurations but they don’t work quite right. For reference, this is the input code:
function add1 (x) {
return x + 1;
}
0 |> add1(%);
My first attempt doesn’t result in errors, but it produces some very odd output:
var _;
function add1(x) {
return x + 1;
}
_ = 0, add1(%)(_);
That is…not valid JavaScript. I tried this configuration and I get an error:
"pipelineOperator" requires "proposal" option whose value must be one of: "minimal", "fsharp", "hack", "smart".
Okay. Where am I supposed to specify that option? This is made all the more confusing by there being several different plugins returned by the demo’s search function. How do I make this work?