Created
November 16, 2014 04:50
-
-
Save iwatakeshi/e3e11492d8893449824e to your computer and use it in GitHub Desktop.
Javascript library template for the Browser and Node.js Bootstrap
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
/*jslint node: true, forin: true, jslint white: true, newcap: true*/ | |
/* | |
* library | |
* author : Takeshi Iwana | |
* https://github.com/iwatakeshi | |
* license : MIT | |
* Code heavily borrowed from Adam Draper | |
* https://github.com/adamwdraper | |
*/ | |
(function() { | |
'use strict'; | |
var library, | |
hasModule = (typeof module !== 'undefined' && module.exports); | |
library = function() { | |
}; | |
/************************************ | |
Exposing library | |
************************************/ | |
// CommonJS module is defined | |
if (hasModule) { | |
module.exports = library; | |
} | |
/*global ender:false */ | |
if (typeof ender === 'undefined') { | |
// here, `this` means `window` in the browser, or `global` on the server | |
// add `library` as a global object via a string identifier, | |
// for Closure Compiler 'advanced' mode | |
this.library = library; | |
} | |
/*global define:false */ | |
if (typeof define === 'function' && define.amd) { | |
define([], function() { | |
return library; | |
}); | |
} | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To create your own library, just replace "library" in your text editor to the desired name.