If I have a module with lots of stuff like this:
My.Module = (function () {
function method1 () {}
function method2 () {}
...
function method99 () {}
return {
method1: method1,
method2: method2,
...
method99: method99
};
})();
How could I avoid repeating the method names? They all appear in three places.
If I were to use a local variable like this:
My.Module = (function () {
var exp = {};
exp.method1 = function () {};
exp.method2 = function () {};
...
exp.method99 = function () {};
return exp;
})();
What should the exp
variable be called? exp
, exports
, exported
, obj
, object
? Does it matter? What's the convention?
If there's a way that is better than both of these, what is it?