hypertune
Version:
[Hypertune](https://www.hypertune.com/) is the most flexible platform for feature flags, A/B testing, analytics and app configuration. Built with full end-to-end type-safety, Git-style version control and local, synchronous, in-memory flag evaluation. Opt
27 lines • 1.41 kB
JavaScript
;
/* eslint-disable @typescript-eslint/ban-ts-comment */
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBackendServer = exports.isReactNative = exports.isBrowser = void 0;
exports.isNextJsBuild = isNextJsBuild;
exports.isNextJsServer = isNextJsServer;
exports.isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
function isNextJsBuild() {
return (typeof process !== "undefined" &&
process.env &&
"__NEXT_DIST_DIR" in process.env);
}
// Detect process.browser === false to determine if we're on a NextJS backend.
// We prefer this over `typeof window` because it gives us a positive indicator
// that the process is aware it is a hybrid that could run in the browser,
// rather than detecting non-browser environments generally.
function isNextJsServer() {
return (typeof process === "object" &&
process &&
// `"browser" in process` returns false in Next.js due to build-time
// inlining, hence the need for a type assertion rather than type guard.
process.browser === false);
}
exports.isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
// Best guess at whether we're on a backend server
exports.isBackendServer = !exports.isBrowser && !isNextJsBuild() && !isNextJsServer() && !exports.isReactNative;
//# sourceMappingURL=environment.js.map