Skip to content

Commit

Permalink
Merge pull request #386 from UziTech/globalThis-polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech authored Dec 31, 2023
2 parents 9657d7b + d9ae798 commit e05ec4d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
// globalThis polyfill from https://mathiasbynens.be/notes/globalthis
const getGlobalThis = () => {
if (typeof globalThis !== 'undefined') return globalThis;
if (typeof self !== 'undefined') return self;
if (typeof window !== 'undefined') return window;
if (typeof global !== 'undefined') return global;
if (typeof this !== 'undefined') return this;
throw new Error('Unable to locate global `this`');
};

if (typeof process === "undefined") {
(window || globalThis).process = require("process/browser");
getGlobalThis().process = require("process/browser");
}

function getLinter() {
Expand Down

0 comments on commit e05ec4d

Please sign in to comment.