Skip to content

Instantly share code, notes, and snippets.

@iwatakeshi
Created November 16, 2014 04:50
Show Gist options
  • Save iwatakeshi/e3e11492d8893449824e to your computer and use it in GitHub Desktop.
Save iwatakeshi/e3e11492d8893449824e to your computer and use it in GitHub Desktop.
Javascript library template for the Browser and Node.js Bootstrap
/*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);
@iwatakeshi
Copy link
Author

To create your own library, just replace "library" in your text editor to the desired name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment