Last active
December 11, 2015 22:03
-
-
Save arturparkhisenko/d176b383b0d2dc3304ba to your computer and use it in GitHub Desktop.
js-module-es5 (Node.js|CommonJS / AMD / Default to window as global)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(exports) { | |
'use strict'; | |
function foo() {} | |
// Node.js|CommonJS / AMD / Default to window as global | |
if (typeof module !== 'undefined' && module.exports) { | |
module.exports = exports = foo; | |
} else if (typeof define === 'function' && define.amd) { | |
define(function() { | |
return foo; | |
}); | |
} else if (typeof window === 'object') { | |
window.foo = foo; | |
} | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment