-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't this be done using |> instead? #1
Comments
Unfortunately, no. Constructions like this a |> b will give syntax error in JavaScript. It will be possible if Babel team provide API for parser plugins, but I don't know if they're planning to do that. |
To avoid syntax error, Babel seem to use two kinds of plugins : I think |
Yes, but API for parser (syntax) plugins isn't public and really poor. Actually babels "official" syntax plugins are hardcoded into babylon. For example, function bind syntax plugin: plugin code and babylon check. |
Oh. So, the best way is to play with mrapogee/babel-plugin-syntax-pipeline-operator and mrapogee/babel-plugin-transform-pipeline-operator and to made a PR on babel/babylon to work well with the Someone is interested about this functionality or this one work well for your needs ? ( cc @mrapogee ) |
Looks like there's already been PR from @mrapogee but it never was merged. |
Oh. Got it ! |
Hey all, I was playing around with this a few months ago and I forked babel to get this working on my setup, but the PR and code referenced above is actually from @mindeavor I did make babylon branch mrapogee/babylon/tree/feature-pipeline that adds the pipeline operator to the syntax. If you get babel-core to import the source from that branch, you may be able to compile the pipeline operator if you include babel-plugin-transform-pipeline-operator in your .babelrc, though I haven't fully tested. |
I want to keep my hands on the official babylon. This plugin works well, and finally the But.. In the esnext proposal about pipeline, @mindeavor works with currying. So ... let result = "hello"
|> doubleSay become let result = doubleSay("hello") Here, you choose to unshift it in the arguments array like Elm. So ... let result = "hello"
|> doubleSay(null) become let result = doubleSay("hello", null) I think currying is a better way to do that stuff. |
No description provided.
The text was updated successfully, but these errors were encountered: