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
Though most of the world is probably using the first convention, this is quite inconsistent as method shorthands (well, at least in V8) set Function#name:
There are also cases where the object property is different than the function name:
{hello: functionfoo(){// ...}}
that could be either ignored (ie. left intact) or use the property name to maintain compatibility (which would through break if the code relies on Function#name.
The text was updated successfully, but these errors were encountered:
The above function will work, but if we try to write it using method syntax, the code won't work:
obj={foo(n){returnn===0||foo(n-1);}};obj.foo(2);// ReferenceError: foo is not defined
Of course Lebab could be smarter and detect whether the function name is actually referenced inside it. But the current implementation doesn't bother with that complexity and just skips these to be on the safe side.
Lebab will transform code like the following:
into the short method, but will leave
intact.
Though most of the world is probably using the first convention, this is quite inconsistent as method shorthands (well, at least in V8) set
Function#name
:There are also cases where the object property is different than the function name:
that could be either ignored (ie. left intact) or use the property name to maintain compatibility (which would through break if the code relies on
Function#name
.The text was updated successfully, but these errors were encountered: