File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 1
1
/* global window self */
2
2
3
3
const isBrowser =
4
- typeof window !== " undefined" && typeof window . document !== " undefined" ;
4
+ typeof window !== ' undefined' && typeof window . document !== ' undefined' ;
5
5
6
6
/* eslint-disable no-restricted-globals */
7
7
const isWebWorker =
8
- typeof self === " object" &&
8
+ typeof self === ' object' &&
9
9
self . constructor &&
10
- self . constructor . name === " DedicatedWorkerGlobalScope" ;
10
+ self . constructor . name === ' DedicatedWorkerGlobalScope' ;
11
11
/* eslint-enable no-restricted-globals */
12
12
13
13
const isNode =
14
- typeof process !== " undefined" &&
14
+ typeof process !== ' undefined' &&
15
15
process . versions != null &&
16
16
process . versions . node != null ;
17
17
18
18
/**
19
19
* @see https://github.com/jsdom/jsdom/releases/tag/12.0.0
20
20
* @see https://github.com/jsdom/jsdom/issues/1537
21
21
*/
22
+ /* eslint-disable no-undef */
22
23
const isJsDom = ( ) =>
23
- ( typeof window !== " undefined" && window . name === " nodejs" ) ||
24
- navigator . userAgent . includes ( " Node.js" ) ||
25
- navigator . userAgent . includes ( " jsdom" ) ;
24
+ ( typeof window !== ' undefined' && window . name === ' nodejs' ) ||
25
+ navigator . userAgent . includes ( ' Node.js' ) ||
26
+ navigator . userAgent . includes ( ' jsdom' ) ;
26
27
27
28
export { isBrowser , isWebWorker , isNode , isJsDom } ;
You can’t perform that action at this time.
0 commit comments