Skip to content

Instantly share code, notes, and snippets.

@varemenos
Last active April 9, 2018 14:32
Show Gist options
  • Save varemenos/ae0e8b208b31e39c065d to your computer and use it in GitHub Desktop.
Save varemenos/ae0e8b208b31e39c065d to your computer and use it in GitHub Desktop.
Sample Javascript module boilerplate
(function (root, name, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory;
} else {
root[name] = factory();
}
})(this, 'myFunc', function () {
'use strict';
var myFunc = function () {};
return myFunc;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment