Modular At-Names

Domenic Denicola domenic at domenicdenicola.com
Tue Oct 16 06:32:50 PDT 2012


From: es-discuss-bounces at mozilla.org [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Yehuda Katz
Sent: Tuesday, October 16, 2012 09:13

> Or, more commonly, symbols that are used in a single class that happens to be inside a module. Although I can't be sure about this, I expect that a large number of modules will exist to encapsulate a single class. This is based on my experience breaking up large JavaScript projects by modules today, where I rarely have multiple "classes" in a single module.

I just want to second how common this is in my experience, both in Node.js and front-end projects. By far the most common module in projects I’ve seen looks like

module.exports = function Class() {
};

(which there isn't even a syntax for in ES6, notably.) For example out of the 150 modules in our current project at work, 4 of them do *not* follow this pattern.


More information about the es-discuss mailing list