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

env-var

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-var - npm Package Compare versions

Comparing version 5.1.0 to 5.2.0

3

CHANGELOG.md

@@ -0,1 +1,4 @@

## 5.2.0 (22/11/19)
* The `required()` function now verifies the variable is not an empty string
## 5.1.0 (09/09/19)

@@ -2,0 +5,0 @@ * Ability to add custom accessors in PR #72 (thanks @todofixthis)

@@ -114,2 +114,7 @@ 'use strict'

const value = typeof container[varName] === 'undefined' ? defValue : container[varName]
if (value.trim().length === 0) {
throw new EnvVarError(`"${varName}" is a required variable, but its value was empty`)
}
return accessors

@@ -116,0 +121,0 @@ }

10

package.json
{
"name": "env-var",
"version": "5.1.0",
"version": "5.2.0",
"description": "Verification, sanatization, and type coercion for environment variables in Node.js",

@@ -54,11 +54,11 @@ "main": "env-var.js",

"devDependencies": {
"@types/node": "~12.7.0",
"bluebird": "~3.5.1",
"@types/node": "~12.12.0",
"bluebird": "~3.7.0",
"chai": "~4.2.0",
"coveralls": "~3.0.0",
"husky": "~3.0.0",
"husky": "~3.1.0",
"mocha": "~6.2.0",
"mocha-lcov-reporter": "~1.3.0",
"nyc": "~14.1.0",
"standard": "~14.1.0",
"standard": "~14.3.0",
"typescript": "~3.1.3"

@@ -65,0 +65,0 @@ },

@@ -274,4 +274,4 @@ # env-var

#### required(isRequired = true)
Ensure the variable is set on *process.env*. If the variable is not set this
function will throw an `EnvVarError`. If the variable is set it returns itself
Ensure the variable is set on *process.env*. If the variable is not set or empty
this function will throw an `EnvVarError`. If the variable is set it returns itself
so you can access the underlying variable.

@@ -287,4 +287,4 @@

// Read PORT variable and ensure it's a positive integer. If it is not a
// positive integer or is not set the process will exit with an error (unless
// you catch it using a try/catch or "uncaughtException" handler)
// positive integer, not set or empty the process will exit with an error
// (unless you catch it using a try/catch or "uncaughtException" handler)
const NODE_ENV = env.get('NODE_ENV').asString()

@@ -407,3 +407,3 @@ const PORT = env.get('PORT').required().asIntPositive()

// Returns a string. Throws an exception if not set
// Returns a string. Throws an exception if not set or empty
const stringVar = env.get('STRING').required().asString();

@@ -410,0 +410,0 @@

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