Huge News!Announcing our $40M Series B led by Abstract Ventures.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.2.17 to 1.2.18

18

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

@@ -11,6 +11,5 @@ 'use strict';

function _extends() {
_extends = Object.assign || function (target) {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {

@@ -22,6 +21,4 @@ if (Object.prototype.hasOwnProperty.call(source, key)) {

}
return target;
};
return _extends.apply(this, arguments);

@@ -41,11 +38,8 @@ }

}
var _options = options,
requiredProperties = _options.requiredProperties,
coerceVars = _options.coerceVars;
requiredProperties = _options.requiredProperties,
coerceVars = _options.coerceVars;
if (!validationSchema) {
throw new Error('Impossible to load environment variables validation schema.');
}
var schema = {

@@ -57,5 +51,3 @@ type: 'object',

var validate = ajv.compile(schema);
var data = _extends({}, process.env);
if (!validate(data)) {

@@ -66,3 +58,2 @@ throw new Error(ajv.errorsText(validate.errors, {

}
if (typeof coerceVars === 'undefined' ? true : coerceVars) {

@@ -72,3 +63,2 @@ process.env = data;

};
(function (Environment) {

@@ -81,6 +71,4 @@ Environment["TEST"] = "test";

})(exports.Environment || (exports.Environment = {}));
var currentEnv = function currentEnv() {
var _ref, _ref$toString, _ref$toString$toLower;
return (_ref = "development" ) == null ? void 0 : (_ref$toString = _ref.toString()) == null ? void 0 : (_ref$toString$toLower = _ref$toString.toLowerCase()) == null ? void 0 : _ref$toString$toLower.trim();

@@ -87,0 +75,0 @@ };

2

dist/env-vars-validator.cjs.production.min.js

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

"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)};
"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")),n=e(require("ajv-formats"));function t(){return(t=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}var o,i=new r({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 e,r;return null==(e="production".toString())||null==(r=e.toLowerCase())?void 0:r.trim()};exports.currentEnv=s,exports.isDeployedEnv=function(){return-1!==Object.values(exports.Environment).filter((function(e){return e!==exports.Environment.TEST&&e!==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(e,r){void 0===r&&(r={coerceVars:!0});var n=r.requiredProperties,o=r.coerceVars;if(!e)throw new Error("Impossible to load environment variables validation schema.");var s={type:"object",properties:t({},e),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

@@ -5,6 +5,5 @@ import Ajv from 'ajv';

function _extends() {
_extends = Object.assign || function (target) {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {

@@ -16,6 +15,4 @@ if (Object.prototype.hasOwnProperty.call(source, key)) {

}
return target;
};
return _extends.apply(this, arguments);

@@ -35,11 +32,8 @@ }

}
var _options = options,
requiredProperties = _options.requiredProperties,
coerceVars = _options.coerceVars;
requiredProperties = _options.requiredProperties,
coerceVars = _options.coerceVars;
if (!validationSchema) {
throw new Error('Impossible to load environment variables validation schema.');
}
var schema = {

@@ -51,5 +45,3 @@ type: 'object',

var validate = ajv.compile(schema);
var data = _extends({}, process.env);
if (!validate(data)) {

@@ -60,3 +52,2 @@ throw new Error(ajv.errorsText(validate.errors, {

}
if (typeof coerceVars === 'undefined' ? true : coerceVars) {

@@ -67,3 +58,2 @@ process.env = data;

var Environment;
(function (Environment) {

@@ -76,6 +66,4 @@ Environment["TEST"] = "test";

})(Environment || (Environment = {}));
var currentEnv = function currentEnv() {
var _ref, _ref$toString, _ref$toString$toLower;
return (_ref = !!process.env.NODE_ENV && process.env.NODE_ENV !== undefined ? process.env.NODE_ENV : Environment.DEVELOPMENT) == null ? void 0 : (_ref$toString = _ref.toString()) == null ? void 0 : (_ref$toString$toLower = _ref$toString.toLowerCase()) == null ? void 0 : _ref$toString$toLower.trim();

@@ -82,0 +70,0 @@ };

{
"version": "1.2.17",
"version": "1.2.18",
"license": "MIT",

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

"@typescript-eslint/parser": "5.57.0",
"eslint": "8.36.0",
"eslint": "8.37.0",
"eslint-config-prettier": "8.8.0",

@@ -66,0 +66,0 @@ "eslint-plugin-import": "2.27.5",

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