Socket
Socket
Sign inDemoInstall

processenv

Package Overview
Dependencies
Maintainers
5
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

processenv - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

.releaserc.json

9

package.json
{
"name": "processenv",
"version": "3.0.0",
"version": "3.0.1",
"description": "processenv parses environment variables.",

@@ -27,6 +27,7 @@ "contributors": [

"devDependencies": {
"assertthat": "4.0.2",
"assertthat": "5.1.0",
"nodeenv": "3.0.0",
"roboter": "9.1.0",
"uuidv4": "5.0.1"
"roboter": "10.0.1",
"semantic-release-configuration": "1.0.6",
"uuidv4": "6.0.0"
},

@@ -33,0 +34,0 @@ "repository": {

@@ -12,3 +12,3 @@ # processenv

| Dev dependencies | ![David](https://img.shields.io/david/dev/thenativeweb/processenv) |
| Build | [![CircleCI](https://img.shields.io/circleci/build/github/thenativeweb/processenv)](https://circleci.com/gh/thenativeweb/processenv/tree/master) |
| Build | ![GitHub Actions](https://github.com/thenativeweb/processenv/workflows/Release/badge.svg?branch=master) |
| License | ![GitHub](https://img.shields.io/github/license/thenativeweb/processenv) |

@@ -66,15 +66,12 @@

#### Using the `||` operator
#### Using the `??` operator
Instead of providing a second parameter, you may use the `||` operator to handle default values. However, this may lead to problems with boolean values, e.g. if you want to use a default value of `true`:
Instead of providing a second parameter, you may use the `??` operator to handle default values:
```javascript
// This will always evaluate to true, no matter whether ROOT is false or true.
const isRoot = processenv('ROOT') || true;
const isRoot = processenv('ROOT') ?? true;
```
The underlying problem here is that when a value of `false` is given for the environment variable, the `||` operator automatically falls back to the `true` keyword, hence the result will always be `true`.
*Please note that this is only true if you are using the `??` operator. If you are using the old-style `||` operator instead, the previous line always returns `true`, no matter what the actual value of the `ROOT` environment variable is. To avoid this problem, either use the `??` operator or use the previously shown syntax using a second parameter to provide a default value.*
To avoid this problem, always use the previously shown syntax using a second parameter to provide default values.
### Getting all environment variables

@@ -81,0 +78,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