Skip to content

Instantly share code, notes, and snippets.

@sirlancelot
Last active August 29, 2015 14:14
Show Gist options
  • Save sirlancelot/56c5108fc2bdeef0fb4d to your computer and use it in GitHub Desktop.
Save sirlancelot/56c5108fc2bdeef0fb4d to your computer and use it in GitHub Desktop.
Module definition compatible for use in Node.js & Browser environments.
// Defines a module that works in Node & Browsers
(function(global, factory) {
var mock = { exports: {} }
var local = (typeof module === "object" && module.exports) ? module : mock
factory(local, local.exports)
if (local === mock) global["yourNamespaceHere"] = local.exports
}(this, function(module, exports) {
"use strict";
// Add your work to `exports` or `module.exports`
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment