I have used Node.js extensively. In that environment, as I'm sure you know, a module exports one thing. It can be an object with lots of properties on it, a single function, or a single value. I suppose you could say that all Node has is a "default" export which is the one thing the module exports.
I'm trying to understand how that compares to ES6 modules. I see how in ES6 I can import specific things from a module or I can import everything a module exports. Am I correct that a "default" export can be somewhere in the middle ... a subset of everything that is exported? On Fri, Mar 14, 2014 at 8:22 AM, Domenic Denicola < [email protected]> wrote: > Have you ever used JavaScript module systems before? If so, the idea of a > default export should be somewhat familiar... > > > On Mar 14, 2014, at 6:31, "Mark Volkmann" <[email protected]> > wrote: > > > > I'm trying to understand the options for exporting things from a module. > > Here's how I think it works, mostly based on what I see in Traceur. > > Does any of this look wrong? > > > > To export a value, > > export var someName = someValue; > > > > To export a function, > > export function someName(args) { ... }; > > > > To export multiple things defined elsewhere in this file, > > export {name1, name2, ...}; > > > > Here's the part that confuses me most. It seems that importers have > three options. > > 1) import specific things from a given module > > 2) import everything that was exported from a given module > > 3) import a subset of what a given module exports that it identified as > the "default" (presumably the most commonly used things) > > > > To define the default subset of things to export from a module, > > export default = some-value or some-function; > > where some-value could be an object holding a collection of things to > export. > > > > -- > > R. Mark Volkmann > > Object Computing, Inc. > > _______________________________________________ > > es-discuss mailing list > > [email protected] > > https://mail.mozilla.org/listinfo/es-discuss > -- R. Mark Volkmann Object Computing, Inc.
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

