New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

env-collector

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-collector

----

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

ENV COLLECTOR

A lightweight and simple way to handle environment variables for NodeJS.

Installation

yarn add env-collector

Usage

import EnvCollector from 'env-collector';

// Simple use case.
const myEnvVar: string = EnvCollector.collect('MY_VAR').asString();

// Defining a fallback value.
const myEnvVar: string = EnvCollector.collect('ENV')
  .fallbackTo('development')
  .asString();

// Fail if environment variable not set.
const myEnvVar: string = EnvCollector.collect('API_ENDPOINT')
  .orFailWith('Environment variable `API_ENDPOINT` not set!')
  .asString();
  
// Only fail if a certain condition is met.
const myEnvVar: string = EnvCollector.collect('PRODUCTION_SECRET')
  .orFailWith('Environment variable `PRODUCTION_SECRET` not set!'
  .onlyFailIf(isProduction)
  .asString();

FAQs

Package last updated on 09 Jul 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