Socket
Socket
Sign inDemoInstall

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


Version published
Weekly downloads
3
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

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