Created
April 2, 2012 00:52
-
-
Save hitsujiwool/2279812 to your computer and use it in GitHub Desktop.
module export pattern in Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// module pattern 1 | |
(function(exports) { | |
var ns = {}; | |
ns.method = function() {}; | |
exports.ns = ns; | |
}(this)); | |
// module pattern 2 | |
var ns = (function(exports) { | |
exports.method = function() {}; | |
return exports; | |
}({})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment