I'm having trouble rewriting this to work in 'strict' mode. Since 'this' is not defined explicitly I'm getting jshint errors on compile. I'm thinking my brain is just not thinking abstractly enough to find a creative solution. Any help would be appreciated. Code adapted from the Universal Module Definition Github repo: https://github.com/umdjs/umd/blob/master/returnExports.js
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD Module
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// Node Module
module.exports = factory();
} else {
// Browser Global
root.returnExports = factory();
}
}(this, function () {
return {};
}));
this
refer to? It depends on environment right? you could just not pass that in at all, and instead refer towindow
in the else statement. – Felishathis
refers to the current environment. So usingwindow
will allow the correct functionality in some environments but will not allow interoperability between environments, which is my goal. I've updated my question with a link to the Universal Module Definition Github project – Torpedo