Skip to content

Instantly share code, notes, and snippets.

@hitsujiwool
Created April 2, 2012 00:52
Show Gist options
  • Save hitsujiwool/2279812 to your computer and use it in GitHub Desktop.
Save hitsujiwool/2279812 to your computer and use it in GitHub Desktop.
module export pattern in Node.js
// 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