New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

env-vars-validator

Package Overview
Dependencies
Maintainers
1
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-vars-validator - npm Package Compare versions

Comparing version 1.1.165 to 1.2.1

27

dist/env-vars-validator.cjs.development.js

@@ -67,9 +67,10 @@ 'use strict';

};
var Environment;
(function (Environment) {
Environment["TEST"] = "test";
Environment["DEVELOPMENT"] = "development";
Environment["STAGING"] = "staging";
Environment["PREPRODUCTION"] = "preproduction";
Environment["PRODUCTION"] = "production";
Environment["DEVELOPMENT"] = "development";
Environment["TEST"] = "test";
})(Environment || (Environment = {}));
})(exports.Environment || (exports.Environment = {}));

@@ -82,12 +83,20 @@ var currentEnv = function currentEnv() {

var isProductionEnv = function isProductionEnv() {
return currentEnv() === Environment.PRODUCTION;
return currentEnv() === exports.Environment.PRODUCTION;
};
var isPreProductionEnv = function isPreProductionEnv() {
return currentEnv() === exports.Environment.PREPRODUCTION;
};
var isStagingEnv = function isStagingEnv() {
return currentEnv() === exports.Environment.STAGING;
};
var isDevelopmentEnv = function isDevelopmentEnv() {
return currentEnv() === Environment.DEVELOPMENT;
return currentEnv() === exports.Environment.DEVELOPMENT;
};
var isTestEnv = function isTestEnv() {
return currentEnv() === Environment.TEST;
return currentEnv() === exports.Environment.TEST;
};
var isDeployedEnv = function isDeployedEnv() {
return currentEnv() !== Environment.DEVELOPMENT && currentEnv() !== Environment.TEST;
return Object.values(exports.Environment).filter(function (v) {
return v !== exports.Environment.TEST && v !== exports.Environment.DEVELOPMENT;
}).indexOf(currentEnv()) !== -1;
};

@@ -98,5 +107,7 @@

exports.isDevelopmentEnv = isDevelopmentEnv;
exports.isPreProductionEnv = isPreProductionEnv;
exports.isProductionEnv = isProductionEnv;
exports.isStagingEnv = isStagingEnv;
exports.isTestEnv = isTestEnv;
exports.validateEnv = validateEnv;
//# sourceMappingURL=env-vars-validator.cjs.development.js.map

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("ajv")),t=e(require("ajv-formats"));function o(){return(o=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)}var n,i=new r({coerceTypes:!0,useDefaults:!0});t(i),function(e){e.PRODUCTION="production",e.DEVELOPMENT="development",e.TEST="test"}(n||(n={}));var s=function(){var e,r;return null==(e="production".toString())||null==(r=e.toLowerCase())?void 0:r.trim()};exports.currentEnv=s,exports.isDeployedEnv=function(){return s()!==n.DEVELOPMENT&&s()!==n.TEST},exports.isDevelopmentEnv=function(){return s()===n.DEVELOPMENT},exports.isProductionEnv=function(){return s()===n.PRODUCTION},exports.isTestEnv=function(){return s()===n.TEST},exports.validateEnv=function(e,r){void 0===r&&(r={coerceVars:!0});var t=r.requiredProperties,n=r.coerceVars;if(!e)throw new Error("Impossible to load environment variables validation schema.");var s={type:"object",properties:o({},e),required:t},u=i.compile(s),a=o({},process.env);if(!u(a))throw new Error(i.errorsText(u.errors,{dataVar:"process.env"}));(void 0===n||n)&&(process.env=a)};
"use strict";function r(r){return r&&"object"==typeof r&&"default"in r?r.default:r}Object.defineProperty(exports,"__esModule",{value:!0});var e=r(require("ajv")),n=r(require("ajv-formats"));function t(){return(t=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r}).apply(this,arguments)}var o,i=new e({coerceTypes:!0,useDefaults:!0});n(i),(o=exports.Environment||(exports.Environment={})).TEST="test",o.DEVELOPMENT="development",o.STAGING="staging",o.PREPRODUCTION="preproduction",o.PRODUCTION="production";var s=function(){var r,e;return null==(r="production".toString())||null==(e=r.toLowerCase())?void 0:e.trim()};exports.currentEnv=s,exports.isDeployedEnv=function(){return-1!==Object.values(exports.Environment).filter((function(r){return r!==exports.Environment.TEST&&r!==exports.Environment.DEVELOPMENT})).indexOf(s())},exports.isDevelopmentEnv=function(){return s()===exports.Environment.DEVELOPMENT},exports.isPreProductionEnv=function(){return s()===exports.Environment.PREPRODUCTION},exports.isProductionEnv=function(){return s()===exports.Environment.PRODUCTION},exports.isStagingEnv=function(){return s()===exports.Environment.STAGING},exports.isTestEnv=function(){return s()===exports.Environment.TEST},exports.validateEnv=function(r,e){void 0===e&&(e={coerceVars:!0});var n=e.requiredProperties,o=e.coerceVars;if(!r)throw new Error("Impossible to load environment variables validation schema.");var s={type:"object",properties:t({},r),required:n},p=i.compile(s),u=t({},process.env);if(!p(u))throw new Error(i.errorsText(p.errors,{dataVar:"process.env"}));(void 0===o||o)&&(process.env=u)};
//# sourceMappingURL=env-vars-validator.cjs.production.min.js.map

@@ -64,5 +64,7 @@ import Ajv from 'ajv';

(function (Environment) {
Environment["TEST"] = "test";
Environment["DEVELOPMENT"] = "development";
Environment["STAGING"] = "staging";
Environment["PREPRODUCTION"] = "preproduction";
Environment["PRODUCTION"] = "production";
Environment["DEVELOPMENT"] = "development";
Environment["TEST"] = "test";
})(Environment || (Environment = {}));

@@ -78,2 +80,8 @@

};
var isPreProductionEnv = function isPreProductionEnv() {
return currentEnv() === Environment.PREPRODUCTION;
};
var isStagingEnv = function isStagingEnv() {
return currentEnv() === Environment.STAGING;
};
var isDevelopmentEnv = function isDevelopmentEnv() {

@@ -86,6 +94,8 @@ return currentEnv() === Environment.DEVELOPMENT;

var isDeployedEnv = function isDeployedEnv() {
return currentEnv() !== Environment.DEVELOPMENT && currentEnv() !== Environment.TEST;
return Object.values(Environment).filter(function (v) {
return v !== Environment.TEST && v !== Environment.DEVELOPMENT;
}).indexOf(currentEnv()) !== -1;
};
export { currentEnv, isDeployedEnv, isDevelopmentEnv, isProductionEnv, isTestEnv, validateEnv };
export { Environment, currentEnv, isDeployedEnv, isDevelopmentEnv, isPreProductionEnv, isProductionEnv, isStagingEnv, isTestEnv, validateEnv };
//# sourceMappingURL=env-vars-validator.esm.js.map

@@ -5,6 +5,15 @@ export declare const validateEnv: (validationSchema: object, options?: {

}) => void;
export declare enum Environment {
TEST = "test",
DEVELOPMENT = "development",
STAGING = "staging",
PREPRODUCTION = "preproduction",
PRODUCTION = "production"
}
export declare const currentEnv: () => string;
export declare const isProductionEnv: () => boolean;
export declare const isPreProductionEnv: () => boolean;
export declare const isStagingEnv: () => boolean;
export declare const isDevelopmentEnv: () => boolean;
export declare const isTestEnv: () => boolean;
export declare const isDeployedEnv: () => boolean;
{
"version": "1.1.165",
"version": "1.2.1",
"license": "MIT",

@@ -71,3 +71,3 @@ "repository": {

"prettier": "2.8.4",
"size-limit": "8.1.2",
"size-limit": "8.2.4",
"standard-version": "9.5.0",

@@ -74,0 +74,0 @@ "tsdx": "0.14.1",

@@ -48,6 +48,8 @@ import Ajv from 'ajv';

enum Environment {
export enum Environment {
TEST = 'test',
DEVELOPMENT = 'development',
STAGING = 'staging',
PREPRODUCTION = 'preproduction',
PRODUCTION = 'production',
DEVELOPMENT = 'development',
TEST = 'test',
}

@@ -64,5 +66,10 @@

export const isProductionEnv = () => currentEnv() === Environment.PRODUCTION;
export const isPreProductionEnv = () =>
currentEnv() === Environment.PREPRODUCTION;
export const isStagingEnv = () => currentEnv() === Environment.STAGING;
export const isDevelopmentEnv = () => currentEnv() === Environment.DEVELOPMENT;
export const isTestEnv = () => currentEnv() === Environment.TEST;
export const isDeployedEnv = () =>
currentEnv() !== Environment.DEVELOPMENT && currentEnv() !== Environment.TEST;
Object.values(Environment)
.filter((v) => v !== Environment.TEST && v !== Environment.DEVELOPMENT)
.indexOf(currentEnv() as Environment) !== -1;

Sorry, the diff of this file is not supported yet

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