Skip to content

Instantly share code, notes, and snippets.

@iamdustan
Created July 2, 2012 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamdustan/3035422 to your computer and use it in GitHub Desktop.
Save iamdustan/3035422 to your computer and use it in GitHub Desktop.
((name, context, definition) ->
if typeof module isnt "undefined"
module.exports = definition(name, context)
else if typeof define is "function" and typeof define.amd is "object"
define definition
else
context[name] = definition(name, context)
) "moduleName", this, (name, context) ->
# module code it up
(function (name, context, definition) {
if (typeof module !== 'undefined') module.exports = definition(name, context);
else if (typeof define === 'function' && typeof define.amd === 'object') define(definition);
else context[name] = definition(name, context);
}('moduleName', this, function(name, context) {
// ... module code goes here ...
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment