Add support for AMD modules (Require.js)
Opened this issue · 0 comments
mvasilkov commented
Because compatibility.
Something along these lines would do:
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.noop = factory();
}
}(this, function () {
// Return a value to define the module export.
return function noop(){};
}));