From 6a4c3d7f2c617c8a92f3835af6af76a33ede7591 Mon Sep 17 00:00:00 2001 From: dcode Date: Tue, 14 Jul 2020 00:39:33 +0200 Subject: [PATCH] Fix util.global --- src/util/minimal.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/minimal.js b/src/util/minimal.js index 41f327c2f..e384b62fb 100644 --- a/src/util/minimal.js +++ b/src/util/minimal.js @@ -26,8 +26,8 @@ util.pool = require("@protobufjs/pool"); util.LongBits = require("./longbits"); // global object reference -util.global = typeof window !== "undefined" && window - || typeof global !== "undefined" && global +util.global = typeof global !== "undefined" && Object.prototype.toString.call(global) === "[object global]" && global + || typeof window !== "undefined" && window || typeof self !== "undefined" && self || this; // eslint-disable-line no-invalid-this @@ -52,7 +52,7 @@ util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next * * @type {boolean} * @const */ -util.isNode = Boolean(process && process.versions && process.versions.node); +util.isNode = Boolean(util.global.process && util.global.process.versions && util.global.process.versions.node); /** * Tests if the specified value is an integer.