Skip to content

Commit 52cd900

Browse files
committed
chore: update code
1 parent 5dfab58 commit 52cd900

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/runtime/getGlobalThis.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@ module.exports = (function () {
44
return globalThis;
55
}
66

7-
let globalObj;
7+
// eslint-disable-next-line id-length
8+
let g;
89

910
try {
1011
// This works if eval is allowed (see CSP)
1112
// eslint-disable-next-line no-new-func
12-
globalObj = this || new Function("return this")();
13+
g = this || new Function("return this")();
1314
} catch {
1415
// This works if the window reference is available
15-
// eslint-disable-next-line unicorn/prefer-global-this
16+
/* eslint-disable unicorn/prefer-global-this, no-undef */
1617
if (typeof window === "object") {
17-
// eslint-disable-next-line unicorn/prefer-global-this, no-undef
1818
return window;
1919
}
20-
2120
// This works if the self reference is available
22-
if (typeof globalThis.self === "object") {
23-
return globalThis;
21+
if (typeof self === "object") {
22+
return self;
2423
}
2524

2625
// This works if the global reference is available
27-
if (typeof globalThis.global !== "undefined") {
28-
return globalThis;
26+
if (typeof global !== "undefined") {
27+
return global;
2928
}
29+
/* eslint-enable unicorn/prefer-global-this, no-undef */
3030
}
3131

32-
return globalObj;
32+
return g;
3333
})();

0 commit comments

Comments
 (0)