Skip to content

Instantly share code, notes, and snippets.

@vitalk
Created December 19, 2013 10:44
Show Gist options
  • Save vitalk/8037418 to your computer and use it in GitHub Desktop.
Save vitalk/8037418 to your computer and use it in GitHub Desktop.
Unified Javascript module loader
!(function(name, definition) {
var hasDefine = typeof define === 'function',
hasExports = typeof module !== 'undefined' && module.exports;
if (hasDefine) {
define(name, definition);
} else if (hasExports) {
module.exports = definition();
} else {
this[name] = definition();
}
}('name', function() {
'use strict';
// Your code goes here...
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment