Skip to content

Instantly share code, notes, and snippets.

@copyrighthero
Created October 9, 2018 07:39
Show Gist options
  • Save copyrighthero/5327b04114d3adf747926de45c10e94d to your computer and use it in GitHub Desktop.
Save copyrighthero/5327b04114d3adf747926de45c10e94d to your computer and use it in GitHub Desktop.
UMD ECMAScript
((global, factory) => {
'use strict';
// module identifier
const identifier = 'identifier';
// module exportation
if (typeof define === 'function' && define.amd) {
// AMD module
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-Like module
module.exports = factory();
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS strict module
exports[identifier] = factory();
} else {
// Global module
global[identifier] = factory();
}
})(this, () => (() => {
'use strict';
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment