Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@marknotton/env

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marknotton/env

Add, edit, delete and read variables from any .env file.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8K
increased by47.22%
Maintainers
1
Weekly downloads
 
Created
Source

Env

Made For NPM

Add, edit, delete and read variables from a .env file.

Installation

npm i @marknotton/env --save-dev
import Env from '@marknotton/env'

Usage

Basic usage

const env = new Env()

You can defined a different .env file by passing in a string that is relative path.

const env = new Env('.env.example')

Methods

Set Variable

Add a variable and value to the .env file. Variable will be created if it isn't found. It will be overwritten if it does exists.

env.set(variable, value)

Delete Variable

Delete variable from .env file.

env.delete(variable)

Toggle Variable

Add a 'true' boolean to the given vairable, or remove it entirely if it's false.

env.toggleBoolean(variable, true)  // Add's VARIABLE=true 
env.toggleBoolean(variable, false) // Removes VARIABLE=true entirely 

Get Variable

Get variable from .env file.

env.get(variable)

Has Variable

Check if a variable exists.

env.has(variable)

Keywords

FAQs

Package last updated on 07 Jun 2023

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