You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Loose mode is nice, even though my target environments support for-of, I'd like to keep using loose mode to have faster iteration on arrays with convenient for-of syntax.
But sometimes, in rare cases, I may want to take advantage of native for-of in order to edit arrays in place while iterating (including adding or deleting items), but this doesn't work in loose mode for obvious reasons.
Describe the solution you'd like
It'd be nice to have a comment that can enable (or disable) loose for-of. F.e. If we're in loose mode, we could write the following to enable strict mode (it may compile, or may simply output the for-of as-is depending on env config):
// @babel no-loosefor(constitemofarray){// ...}
Not sure about the comment format, but you get the idea.
Conversely, someone with loose mode turned off might want to do
// @babel loosefor(constitemofarray){// ...}
The no-* could be a generic commenting mechanism to disable/enable some feature.
Describe alternatives you've considered
I can opt for the strict mode by converting an array into a Set, for example. But it seems clunky.
Hey @trusktr! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.
Feature Request
Is your feature request related to a problem? Please describe.
Loose mode is nice, even though my target environments support for-of, I'd like to keep using loose mode to have faster iteration on arrays with convenient for-of syntax.
But sometimes, in rare cases, I may want to take advantage of native for-of in order to edit arrays in place while iterating (including adding or deleting items), but this doesn't work in loose mode for obvious reasons.
Describe the solution you'd like
It'd be nice to have a comment that can enable (or disable) loose for-of. F.e. If we're in loose mode, we could write the following to enable strict mode (it may compile, or may simply output the for-of as-is depending on
env
config):Not sure about the comment format, but you get the idea.
Conversely, someone with loose mode turned off might want to do
The
no-*
could be a generic commenting mechanism to disable/enable some feature.Describe alternatives you've considered
I can opt for the strict mode by converting an array into a Set, for example. But it seems clunky.
Teachability, Documentation, Adoption, Migration Strategy
...
Sidenote, in my tests, the following hand-written version I've been using,
is almost three times faster than Babel's output.
The text was updated successfully, but these errors were encountered: