Skip to content

Commit

Permalink
fix: global
Browse files Browse the repository at this point in the history
  • Loading branch information
fupengl committed May 15, 2021
1 parent ab1deeb commit 6af4754
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/global.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
const check = function (it): it is typeof global {
return typeof it == 'object' && it.Object === Object;
return it && it.Object === Object && it;
};

/**
* global
*/
const _global = check(global) && global;
const _global = check(typeof global == 'object' && global);

/**
* window
*/
const _window = check(window) && window;
const _window = check(typeof window == 'object' && window);

/**
* globalThis
*/
const _globalThis = check(globalThis) && globalThis;
const _globalThis = check(typeof globalThis == 'object' && globalThis);

/**
* self
*/
// eslint-disable-next-line no-restricted-globals
const _self = check(self) && self;
const _self = check(typeof self == 'object' && self);

/**
* func this
Expand Down

0 comments on commit 6af4754

Please sign in to comment.