In Node.js, the difference is: module.exports = function () { … };
versus module.exports = { foo: …, bar: …, baz: … }; So, conceptually, the former piece of code exports a single value, while the latter exports multiple values. Axel On Jul 4, 2013, at 23:47 , Sean Silva <sil...@purdue.edu> wrote: > > > > On Thu, Jul 4, 2013 at 7:43 AM, Axel Rauschmayer <a...@rauschma.de> wrote: > When importing from a multi-export module, you need to wrap things in braces, > which enables convenient syntax for single-export modules. > Why? Have single-export modules in npm been counted? Are there more than > multi-export modules? > > I’m guessing that single-export modules will usually export functions, right? > > > In a sense, doesn't require()-style modules enforce only single-exports? Only > a single value can be exported from a module, no? > > I haven't been following the ES6 modules functionality super-closely, so I > may be misinformed: My understanding is that the current ES6 proposed way to > do module exports adds a new language construct for aggregating multiple > values and passing them to another part of the program (namely, that all > `export`'ed declarations are aggregated in a new way and made available to > `import` statements, which use new language constructs to access the values > aggregated by the module (`import foo from ...`, `module foo from ...`) and > renaming values (`as`)). > > > -- Sean Silva -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss