function getGlobals(): typeof globalThis | undefined {
if (typeof globalThis !== 'undefined') {
return globalThis;
} else if (typeof self !== 'undefined') {
return self;
} else if (typeof global !== 'undefined') {
return global;
}
return undefined;
}
export const globals = getGlobals();
export const getGlobalThis = (): typeof globalThis => {
if (typeof globalThis !== 'undefined') return globalThis;
if (typeof self !== 'undefined') return self;
if (typeof window !== 'undefined') return window;
if (typeof global !== 'undefined') return global as any;
if (typeof this !== 'undefined') return this as any;
throw new Error('Unable to locate global `this`');
};