Skip to content

Instantly share code, notes, and snippets.

@anasnakawa
Last active January 4, 2016 00:09
Show Gist options
  • Save anasnakawa/8540133 to your computer and use it in GitHub Desktop.
Save anasnakawa/8540133 to your computer and use it in GitHub Desktop.
the tiniest module wrapper for CommonJs / AMD and the browser
// Tiniest Module Wrapper - (c) Anas Nakawa - <anas.nakawa {at} gmail.com>
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
(function() {
function myLibrary() {};
// CommonJs / Node
( typeof module !== "undefined" && module.exports && ( module.exports = myLibrary ) ) ||
// AMD / RequireJs
( typeof define !== "undefined" && !define(function() { return myLibrary; }) ) ||
// browser
( typeof window !== "undefined" && ( window.myLibrary = myLibrary ) );
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment