File tree Expand file tree Collapse file tree 2 files changed +23
-13
lines changed Expand file tree Collapse file tree 2 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -1951,15 +1951,18 @@ export namespace util {
19511951 public length ( ) : number ;
19521952 }
19531953
1954+ /** Whether running within node or not. */
1955+ let isNode : boolean ;
1956+
1957+ /** Global object reference. */
1958+ let global : object ;
1959+
19541960 /** An immuable empty array. */
19551961 const emptyArray : any [ ] ;
19561962
19571963 /** An immutable empty object. */
19581964 const emptyObject : object ;
19591965
1960- /** Whether running within node or not. */
1961- const isNode : boolean ;
1962-
19631966 /**
19641967 * Tests if the specified value is an integer.
19651968 * @param value Value to test
Original file line number Diff line number Diff line change @@ -25,8 +25,23 @@ util.pool = require("@protobufjs/pool");
2525// utility to work with the low and high bits of a 64 bit value
2626util . LongBits = require ( "./longbits" ) ;
2727
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
3045 || typeof window !== "undefined" && window
3146 || typeof self !== "undefined" && self
3247 || this ; // eslint-disable-line no-invalid-this
@@ -46,14 +61,6 @@ util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */
4661 */
4762util . emptyObject = Object . freeze ? Object . freeze ( { } ) : /* istanbul ignore next */ { } ; // used on prototypes
4863
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-
5764/**
5865 * Tests if the specified value is an integer.
5966 * @function
You can’t perform that action at this time.
0 commit comments