Skip to content

Instantly share code, notes, and snippets.

@blasten
Last active August 29, 2015 14:03
Show Gist options
  • Save blasten/e158845da9f2f5622245 to your computer and use it in GitHub Desktop.
Save blasten/e158845da9f2f5622245 to your computer and use it in GitHub Desktop.
Factory pattern for node and the browser
(function(root, factory) {
if (typeof exports == 'object') {
// I'm Node
module.exports = factory(require('./lib'));
} else {
// I'm the Browser
factory(root.lib);
}
}(this, function(lib) {
var module = (function() {
return {
};
})();
return module;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment