@platform/util.is
Advanced tools
Comparing version 0.0.142 to 0.0.144
@@ -1,14 +0,2 @@ | ||
export declare type IsFlags = { | ||
nodeEnv: 'development' | 'production' | 'browser' | string; | ||
browser: boolean; | ||
dev: boolean; | ||
prod: boolean; | ||
test: boolean; | ||
}; | ||
export declare type IsMethods = { | ||
toObject(): IsFlags; | ||
observable(input?: any): boolean; | ||
stream(input?: any): boolean; | ||
}; | ||
export declare type Is = IsFlags & IsMethods; | ||
export declare const is: Is; | ||
export * from './is'; | ||
export * from './types'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.is = void 0; | ||
exports.is = { | ||
get nodeEnv() { | ||
return this.browser ? 'browser' : process.env.NODE_ENV || 'development'; | ||
}, | ||
get browser() { | ||
return typeof window !== 'undefined'; | ||
}, | ||
get dev() { | ||
var env = this.nodeEnv; | ||
return this.browser | ||
? window && window.location.hostname === 'localhost' | ||
: env !== 'production' && env !== 'prod'; | ||
}, | ||
get prod() { | ||
return !this.dev; | ||
}, | ||
get test() { | ||
return this.nodeEnv === 'test'; | ||
}, | ||
toObject: function () { | ||
return { | ||
nodeEnv: this.nodeEnv, | ||
browser: this.browser, | ||
dev: this.dev, | ||
prod: this.prod, | ||
test: this.test, | ||
}; | ||
}, | ||
observable: function (input) { | ||
return typeof (input === null || input === void 0 ? void 0 : input.subscribe) === 'function'; | ||
}, | ||
stream: function (input) { | ||
return typeof (input === null || input === void 0 ? void 0 : input.on) === 'function'; | ||
}, | ||
}; | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./is"), exports); | ||
tslib_1.__exportStar(require("./types"), exports); |
{ | ||
"name": "@platform/util.is", | ||
"version": "0.0.142", | ||
"version": "0.0.144", | ||
"description": "Environment flags.", | ||
@@ -16,4 +16,4 @@ "main": "lib/index", | ||
"devDependencies": { | ||
"@platform/test": "0.2.1", | ||
"@platform/ts": "4.1.3" | ||
"@platform/test": "0.2.2", | ||
"@platform/ts": "4.1.5" | ||
}, | ||
@@ -20,0 +20,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5889
13
161
1