@roderickhsiao/react-i13n
Version:
[Experiment] React I13n provides a performant and scalable solution to application instrumentation.
32 lines (26 loc) • 977 B
JavaScript
/**
* Copyright 2015 - Present, Yahoo Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
import isUndefined from './isUndefined';
var {
NODE_ENV
} = process.env;
export var IS_PROD = NODE_ENV === 'production';
export var IS_TEST = NODE_ENV === 'test';
export var IS_CLIENT = typeof window !== 'undefined';
export var ENVIRONMENT = IS_CLIENT ? 'client' : 'server';
export var IS_DEBUG_MODE = function isDebugMode() {
var _URL, _URL$searchParams;
if (!IS_CLIENT) {
return false;
}
var {
location
} = window;
if (isUndefined(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';
}();