Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@axah/env-utils

Package Overview
Dependencies
Maintainers
7
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axah/env-utils - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

2

lib/parse-env-variable/parse-boolean.js

@@ -12,3 +12,3 @@ "use strict";

if (!(0, _utils.isValueFilled)(key)) {
return (0, _utils.getDevValueOrThrowError)(key, valueInDev);
return (0, _utils.getDevValueIfNotProduction)(key, valueInDev);
}

@@ -15,0 +15,0 @@

@@ -12,3 +12,3 @@ "use strict";

if (!(0, _utils.isValueFilled)(key)) {
return (0, _utils.getDevValueOrThrowError)(key, valueInDev);
return (0, _utils.getDevValueIfNotProduction)(key, valueInDev);
}

@@ -15,0 +15,0 @@

@@ -12,3 +12,3 @@ "use strict";

if (!(0, _utils.isValueFilled)(key)) {
return (0, _utils.getDevValueOrThrowError)(key, valueInDev);
return (0, _utils.getDevValueIfNotProduction)(key, valueInDev);
}

@@ -15,0 +15,0 @@

@@ -12,3 +12,3 @@ "use strict";

if (!(0, _utils.isValueFilled)(key)) {
return (0, _utils.getDevValueOrThrowError)(key, valueInDev);
return (0, _utils.getDevValueIfNotProduction)(key, valueInDev);
}

@@ -15,0 +15,0 @@

@@ -12,3 +12,3 @@ "use strict";

if (!(0, _utils.isValueFilled)(key)) {
return (0, _utils.getDevValueOrThrowError)(key, valueInDev);
return (0, _utils.getDevValueIfNotProduction)(key, valueInDev);
} // In dev environment it can be, that the developer decides not to set a value,

@@ -15,0 +15,0 @@ // because he knows locally it won't be use - e.g. CERT variables.

@@ -6,3 +6,3 @@ "use strict";

});
exports.getDevValueOrThrowError = exports.throwErrorCannotBeParsed = exports.isValueFilled = void 0;
exports.getDevValueIfNotProduction = exports.throwErrorCannotBeParsed = exports.isValueFilled = void 0;

@@ -23,4 +23,4 @@ /**

/**
* Convenience function which returns the valueInDev, if the environment ist development,
* otherwise an error is thrown.
* Convenience function which returns the valueInDev,
* if the environment isn't production, otherwise an error is thrown.
*/

@@ -31,11 +31,7 @@

const getDevValueOrThrowError = (key, valueInDev) => {
if (!process.env.NODE_ENV) {
throw new Error('The environment variable NODE_ENV is not set. The package @axah/env-utils only works with a NODE_ENV set to a value.');
}
if (process.env.NODE_ENV !== 'development') {
const getDevValueIfNotProduction = (key, valueInDev) => {
if (process.env.NODE_ENV === 'production') {
throw new Error(`The environment variable ${key} has not been defined or is empty.`);
} // In dev environment it can be, that the developer decides not to set a value,
// because he knows locally it won't be use - e.g. CERT variables.
// because he knows locally it won't be used - e.g. CERT variables.
// But for smooth coding it should be as if the value cannot be undefined.

@@ -48,2 +44,2 @@ // eslint-disable-next-line flowtype/no-weak-types

exports.getDevValueOrThrowError = getDevValueOrThrowError;
exports.getDevValueIfNotProduction = getDevValueIfNotProduction;
{
"name": "@axah/env-utils",
"version": "1.1.2",
"version": "1.1.3",
"main": "lib/main.js",

@@ -5,0 +5,0 @@ "license": "UNLICENSED",

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

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