UNPKG

891 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.isReactNativeBrowser = exports.isWebWorker = void 0;
4const isStandardBrowserEnv = () => typeof window !== 'undefined' && typeof window.document !== 'undefined';
5const isWebWorkerEnv = () => {
6 var _a, _b;
7 return Boolean(typeof self === 'object' &&
8 ((_b = (_a = self === null || self === void 0 ? void 0 : self.constructor) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.includes('WorkerGlobalScope')));
9};
10const isReactNativeEnv = () => typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
11const isBrowser = isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv();
12exports.isWebWorker = isWebWorkerEnv();
13exports.isReactNativeBrowser = isReactNativeEnv();
14exports.default = isBrowser;
15//# sourceMappingURL=is-browser.js.map
\No newline at end of file