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 7.3.1 to 7.4.0

3

CHANGELOG.md

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

## 7.4.0 (21/08/2023)
* Do not use `process.env` by default in non-Node.js environments (#155)
## 7.3.1 (24/04/2023)

@@ -2,0 +5,0 @@ * Fix parsing even floating point numbers (#166)

3

env-var.js

@@ -55,2 +55,3 @@ 'use strict'

module.exports = from(process.env)
/* istanbul ignore next */
module.exports = from(typeof process === 'undefined' ? {} : process.env)
{
"name": "env-var",
"version": "7.3.1",
"version": "7.4.0",
"description": "Verification, sanitization, and type coercion for environment variables in Node.js",

@@ -5,0 +5,0 @@ "main": "env-var.js",

@@ -51,3 +51,3 @@ # env-var

### Javascript example
### Node.js Javascript example

@@ -73,3 +73,3 @@ ```js

### TypeScript example
### Node.js TypeScript example

@@ -85,2 +85,17 @@ ```ts

### WebApp Example
When using environment variables in a web application, usually your tooling
such as `vite` imposes special conventions and doesn't expose `process.env`.
Use `from` function to workaround this, and create an `env` object like so:
```ts
import { from } from 'env-var'
const env = from({
BASE_URL: import.meta.env.BASE_URL,
VITE_CUSTOM_VARIABLE: import.meta.env.CUSTOM_VARIABLE
})
```
For more examples, refer to the `/example` directory and [EXAMPLE.md](EXAMPLE.md). A summary of the examples available in `/example` is written in the ['Other examples' section of EXAMPLE.md](EXAMPLE.md#other-examples).

@@ -87,0 +102,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