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 a .env file.

  • 1.1.4
  • 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
const env = require('@marknotton/env');

Data functions

Get File [string]

Get the .env file contents as a string

env.getFile()

First parameter can be the path to your .env file relative to the gulpfile.js

Get Data [object]

Get the .env file content with all the variables and values passed into an object

env.getData()

First parameter can be a direct request for a variable. Second parameter can be the path to your .env file relative to the gulpfile.js

Get & Set functions

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.setVariable(variable, value)

Delete Variable [string]

Delete variable from .env file.

env.deleteVariable(variable)

Toggle Variable [string]

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

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

Get Variable [string]

Get variable from .env file.

env.getVariable(variable)

Has Variable [bool]

Check if a variable exists.

env.hasVariable(variable)

Keywords

FAQs

Package last updated on 24 Apr 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