Since JavaScript devs are incapable of defining an unified import standard, this design pattern emerged where you just check every magic global one by one. Here's a demo where a Js library works on both the browser and from Node.js:
- web-cheat/umd_my_lib.js: the library
- web-cheat/umd.js: Node.js user
- web-cheat/umd.html: browser user