Files
codeql/javascript/ql/test/library-tests/AMD/umd2.js
Max Schaefer ea70aaff57 Improve detection of UMD modules.
We previously required the `define` to appear directly as an expression statement, but there are common patterns where this is not the case.
2022-05-30 12:37:50 +02:00

12 lines
424 B
JavaScript

; (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ?
module.exports = factory(require('./a'), require('./dir/b')) :
typeof define === 'function' && define.amd ?
define(['./a', './dir/b'], factory) :
global.mymodule = factory(global.a, global.dir.b)
}(this, function (a, b) {
return {
bar: a.foo,
foo: b.bar
};
}));