File tree 2 files changed +23
-13
lines changed
2 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -1951,15 +1951,18 @@ export namespace util {
1951
1951
public length ( ) : number ;
1952
1952
}
1953
1953
1954
+ /** Whether running within node or not. */
1955
+ let isNode : boolean ;
1956
+
1957
+ /** Global object reference. */
1958
+ let global : object ;
1959
+
1954
1960
/** An immuable empty array. */
1955
1961
const emptyArray : any [ ] ;
1956
1962
1957
1963
/** An immutable empty object. */
1958
1964
const emptyObject : object ;
1959
1965
1960
- /** Whether running within node or not. */
1961
- const isNode : boolean ;
1962
-
1963
1966
/**
1964
1967
* Tests if the specified value is an integer.
1965
1968
* @param value Value to test
Original file line number Diff line number Diff line change @@ -25,8 +25,23 @@ util.pool = require("@protobufjs/pool");
25
25
// utility to work with the low and high bits of a 64 bit value
26
26
util . LongBits = require ( "./longbits" ) ;
27
27
28
- // global object reference
29
- util . global = typeof global !== "undefined" && Object . prototype . toString . call ( global ) === "[object global]" && global
28
+ /**
29
+ * Whether running within node or not.
30
+ * @memberof util
31
+ * @type {boolean }
32
+ */
33
+ util . isNode = Boolean ( typeof global !== "undefined"
34
+ && global
35
+ && global . process
36
+ && global . process . versions
37
+ && global . process . versions . node ) ;
38
+
39
+ /**
40
+ * Global object reference.
41
+ * @memberof util
42
+ * @type {Object }
43
+ */
44
+ util . global = util . isNode && global
30
45
|| typeof window !== "undefined" && window
31
46
|| typeof self !== "undefined" && self
32
47
|| this ; // eslint-disable-line no-invalid-this
@@ -46,14 +61,6 @@ util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */
46
61
*/
47
62
util . emptyObject = Object . freeze ? Object . freeze ( { } ) : /* istanbul ignore next */ { } ; // used on prototypes
48
63
49
- /**
50
- * Whether running within node or not.
51
- * @memberof util
52
- * @type {boolean }
53
- * @const
54
- */
55
- util . isNode = Boolean ( util . global . process && util . global . process . versions && util . global . process . versions . node ) ;
56
-
57
64
/**
58
65
* Tests if the specified value is an integer.
59
66
* @function
You can’t perform that action at this time.
0 commit comments