This minute difference allows the transpiler to maintain syntactic coherence in it's rules for transformation which facilitate optimization and compatibility
It's just a placeholder to maintaining syntactic harmony
what? 🤔
The actual reason is to ensure that the receiver/this is undefined when calling. Maybe you meant that but I didnt really see it explained in the article...
// source:import{sanitize}from'lib';sanitize(n.desc)// `this` inside sanitize is undefined// correct output:const$=__webpack_require__(1);(0,$.sanitize)(n.desc);// `this` inside sanitize is undefined// wrong output:const$=__webpack_require__(1);$.sanitize(n.desc);// `this` inside sanitize is $ (error?)
Not all functions access this but to avoid analyzing (slow) it gets applied anyways
@j4k0xb, thank you so much for this explanation. My interpretation was way too vague so I really appreciate your insight! I've edited this article with hopefully a better explanation.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
what? 🤔
The actual reason is to ensure that the receiver/
thisisundefinedwhen calling. Maybe you meant that but I didnt really see it explained in the article...Not all functions access
thisbut to avoid analyzing (slow) it gets applied anywaysReal example where transpiling to
obj.fn(args)instead of(0, obj.fn)(args)resulted in an error: github.com/es-shims/Promise.allSet...@j4k0xb, thank you so much for this explanation. My interpretation was way too vague so I really appreciate your insight! I've edited this article with hopefully a better explanation.