New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

env-defaults

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-defaults

Loads environment variables from .env file with default value

1.0.3
latest
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

env-defaults

Env-defaults is zero-dependency module to load environment variables from file. Can compatibility use with dotenv

Install

# with npm
npm install env-defaults

# or with Yarn
yarn add env-defaults

Usage

Javascript

const envDefault = require('env-defaults');

const { PORT, NODE_ENV, IS_PRODUCTION } = envDefault.load({
	PORT: 3000,
	NODE_ENV: 'development',
	IS_PRODUCTION: false,
});

TypeScript

import { load } from 'env-defaults';

const { PORT, NODE_ENV, IS_PRODUCTION } = load({
	PORT: 3000,
	NODE_ENV: 'development',
	IS_PRODUCTION: false,
});

Compatibility use with dotenv

Config dot env if nessessary.

require('dotenv').config();

FAQs

Package last updated on 06 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts