UNPKG

@roderickhsiao/react-i13n

Version:

[Experiment] React I13n provides a performant and scalable solution to application instrumentation.

44 lines (32 loc) 1.43 kB
"use strict"; exports.__esModule = true; exports.IS_DEBUG_MODE = exports.ENVIRONMENT = exports.IS_CLIENT = exports.IS_TEST = exports.IS_PROD = void 0; var _isUndefined = _interopRequireDefault(require("./isUndefined")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } /** * Copyright 2015 - Present, Yahoo Inc. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ var NODE_ENV = process.env.NODE_ENV; var IS_PROD = NODE_ENV === 'production'; exports.IS_PROD = IS_PROD; var IS_TEST = NODE_ENV === 'test'; exports.IS_TEST = IS_TEST; var IS_CLIENT = typeof window !== 'undefined'; exports.IS_CLIENT = IS_CLIENT; var ENVIRONMENT = IS_CLIENT ? 'client' : 'server'; exports.ENVIRONMENT = ENVIRONMENT; var IS_DEBUG_MODE = function isDebugMode() { var _URL, _URL$searchParams; if (!IS_CLIENT) { return false; } var _window = window, location = _window.location; if ((0, _isUndefined["default"])(location)) { return false; } // https://caniuse.com/#feat=url (IE needs polyfill) var debugParam = (_URL = new URL(location.href)) === null || _URL === void 0 ? void 0 : (_URL$searchParams = _URL.searchParams) === null || _URL$searchParams === void 0 ? void 0 : _URL$searchParams.get('i13n_debug'); // eslint-disable-line camelcase return debugParam === '1'; }(); exports.IS_DEBUG_MODE = IS_DEBUG_MODE;