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.
Many [].forEach calls can be converted to a for...in safely.
constLANGUAGES={ javascript, json, xml };Object.keys(LANGUAGES).forEach(key=>hljs.registerLanguage(key,LANGUAGES[key]));
Can be converted to...
constLANGUAGES={ javascript, json, xml };for(keyinLANGUAGES){hljs.registerLanguage(key,LANGUAGES[key])}
Describe the solution you'd like
This transform can be done safely so long as the inner function doesn't rely on this being auto bound.
It's worth investigating if there are cases where a function call can be generated that passes the scope as an argument and leverages it correctly as well.
Describe alternatives you've considered
Ignore this transform entirely.
Edit: If order is important, for...of is a better choice.
Because the order of iteration is implementation-dependent, iterating over an array may not visit elements in a consistent order. Therefore, it is better to use a for loop with a numeric index (or Array.prototype.forEach() or the for...of loop) when iterating over arrays where the order of access is important.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Many
[].forEach
calls can be converted to afor...in
safely.Can be converted to...
Describe the solution you'd like
This transform can be done safely so long as the inner function doesn't rely on
this
being auto bound.It's worth investigating if there are cases where a function call can be generated that passes the scope as an argument and leverages it correctly as well.
Describe alternatives you've considered
Ignore this transform entirely.
Edit: If order is important,
for...of
is a better choice.The text was updated successfully, but these errors were encountered: