2 ms·
Fair points, though I quite like the concept of a "variable containing a library" (or module). Personally, with JavaScript being the first language I seriously
by avolcano 13y ago
Fair points, though I quite like the concept of a "variable containing a library" (or module).
Personally, with JavaScript being the first language I seriously learned, it's intuitive for me to reason about. JavaScript is built around closures, and you're simply importing a closure that returns (exports) its public interface.
In fact, the main issue I have with ES6 modules is that they differentiate a "module object" from its default exports, which can be tricky to reason about (basically, what I wanted from ES6 modules was just syntactic sugar over CommonJS, whereas what we have is more powerful but more complex).