Skip to content
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

Arrow Function plugin #147

Merged
merged 4 commits into from
Aug 2, 2021
Merged

Arrow Function plugin #147

merged 4 commits into from
Aug 2, 2021

Conversation

6utt3rfly
Copy link
Collaborator

() => x
x => x
(a, b) => x

Treats '=>' as a binary operator, but replaces the binary expression with the correct node type afterward

() => x
x => x
(a, b) => x

Treats '=>' as a binary operator, but replaces the binary expression with the correct node type afterward
@LeaVerou
Copy link
Collaborator

LeaVerou commented Jul 21, 2021

What about the curly brace syntax though? a => { return 5; }?
Is it out of scope?

@6utt3rfly
Copy link
Collaborator Author

What about the curly brace syntax though? a => { return 5; }?
Is it out of scope?

That could feasibly be another plugin so curly braces could be used to return a sequence of nodes (within an arrow function or not). If both the object and arrow plugins are enabled, then it's possible to use curly braces for an object return value, like [a].map(v => ({ v })).

@6utt3rfly 6utt3rfly changed the base branch from plugin-obj-build to plugin-system July 21, 2021 16:29
@6utt3rfly 6utt3rfly mentioned this pull request Jul 26, 2021
@6utt3rfly 6utt3rfly merged commit 0c6dcf6 into plugin-system Aug 2, 2021
@6utt3rfly 6utt3rfly deleted the plugin-arrow branch August 2, 2021 15:53
@6utt3rfly 6utt3rfly mentioned this pull request Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants