1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var Env = (function () {
|
4 | function Env(_a) {
|
5 | var _b = _a.target, target = _b === void 0 ? 'client' : _b, _c = _a.mode, mode = _c === void 0 ? 'production' : _c;
|
6 | this.target = target;
|
7 | this.mode = mode;
|
8 | }
|
9 | Object.defineProperty(Env.prototype, "isClient", {
|
10 | get: function () { return this.target === 'client'; },
|
11 | enumerable: true,
|
12 | configurable: true
|
13 | });
|
14 | Object.defineProperty(Env.prototype, "isServer", {
|
15 | get: function () { return this.target === 'server'; },
|
16 | enumerable: true,
|
17 | configurable: true
|
18 | });
|
19 | Object.defineProperty(Env.prototype, "isProduction", {
|
20 | get: function () { return this.mode === 'production'; },
|
21 | enumerable: true,
|
22 | configurable: true
|
23 | });
|
24 | Object.defineProperty(Env.prototype, "isDevelopment", {
|
25 | get: function () { return this.mode === 'development'; },
|
26 | enumerable: true,
|
27 | configurable: true
|
28 | });
|
29 | Object.defineProperty(Env.prototype, "isDevelopmentClient", {
|
30 | get: function () { return this.isDevelopment && this.isClient; },
|
31 | enumerable: true,
|
32 | configurable: true
|
33 | });
|
34 | Object.defineProperty(Env.prototype, "isProductionClient", {
|
35 | get: function () { return this.isProduction && this.isClient; },
|
36 | enumerable: true,
|
37 | configurable: true
|
38 | });
|
39 | Object.defineProperty(Env.prototype, "isDevelopmentServer", {
|
40 | get: function () { return this.isDevelopment && this.isServer; },
|
41 | enumerable: true,
|
42 | configurable: true
|
43 | });
|
44 | Object.defineProperty(Env.prototype, "isProductionServer", {
|
45 | get: function () { return this.isProduction && this.isServer; },
|
46 | enumerable: true,
|
47 | configurable: true
|
48 | });
|
49 | Env.prototype.ifServer = function (then, or) { return this.isServer ? then : or; };
|
50 | Env.prototype.ifClient = function (then, or) { return this.isClient ? then : or; };
|
51 | Env.prototype.ifProduction = function (then, or) { return this.isProduction ? then : or; };
|
52 | Env.prototype.ifDevelopment = function (then, or) { return this.isDevelopment ? then : or; };
|
53 | Env.prototype.ifDevelopmentClient = function (then, or) { return this.isDevelopmentClient ? then : or; };
|
54 | Env.prototype.ifProductionClient = function (then, or) { return this.isProductionClient ? then : or; };
|
55 | Env.prototype.ifDevelopmentServer = function (then, or) { return this.isDevelopmentServer ? then : or; };
|
56 | Env.prototype.ifProductionServer = function (then, or) { return this.isProductionServer ? then : or; };
|
57 | return Env;
|
58 | }());
|
59 | exports.default = Env;
|