Skip to content

Instantly share code, notes, and snippets.

@gillesruppert
Created January 18, 2013 14:10
Show Gist options
  • Save gillesruppert/4564755 to your computer and use it in GitHub Desktop.
Save gillesruppert/4564755 to your computer and use it in GitHub Desktop.
simpler AMD/CJS/Node/Global boilerplate
// AMD support
if (typeof define === 'function' && define.amd) {
define(function () { return Cookies; });
// CommonJS and Node.js module support.
} else if (typeof exports !== 'undefined') {
// Support Node.js specific `module.exports` (which can be a function)
if (typeof module != 'undefined' && module.exports) {
exports = module.exports = Cookies;
}
// But always support CommonJS module 1.1.1 spec (`exports` cannot be a function)
exports.Cookies = Cookies;
} else {
window.Cookies = Cookies;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment