Socket
Socket
Sign inDemoInstall

@platform/util.is

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platform/util.is - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

53

lib/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Flags = (function () {
function Flags() {
}
Object.defineProperty(Flags.prototype, "nodeEnv", {
get: function () {
return this.browser ? 'browser' : process.env.NODE_ENV || 'development';
},
enumerable: true,
configurable: true
});
Object.defineProperty(Flags.prototype, "browser", {
get: function () {
return typeof window !== 'undefined';
},
enumerable: true,
configurable: true
});
Object.defineProperty(Flags.prototype, "dev", {
get: function () {
var env = this.nodeEnv;
return this.browser
? window && window.location.hostname === 'localhost'
: env !== 'production' && env !== 'prod';
},
enumerable: true,
configurable: true
});
Object.defineProperty(Flags.prototype, "prod", {
get: function () {
return !this.dev;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Flags.prototype, "test", {
get: function () {
return this.nodeEnv === 'test';
},
enumerable: true,
configurable: true
});
Flags.prototype.toObject = function () {
return {
nodeEnv: this.nodeEnv,
browser: this.browser,
dev: this.dev,
prod: this.prod,
};
};
return Flags;
}());
exports.is = new Flags();

11

lib/index.TEST.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var chai_1 = require("chai");
describe('dummy', function () {
it('succeeds', function () {
chai_1.expect(123).to.eql(123);
var _1 = require(".");
describe('is', function () {
it('test', function () {
chai_1.expect(_1.is.nodeEnv).to.eql('test');
chai_1.expect(_1.is.test).to.eql(true);
});
it('browser', function () {
chai_1.expect(_1.is.browser).to.eql(false);
});
});
{
"name": "@platform/util.is",
"version": "0.0.0",
"version": "0.0.1",
"description": "Environment flags.",

@@ -5,0 +5,0 @@ "main": "lib/index",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc