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

@salestrip/env

Package Overview
Dependencies
Maintainers
6
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@salestrip/env

Environment variable management and utilities

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
6
Created
Source

@salestrip/env

Environment variable management and utilities.

Install

npm i @salestrip/env

Usage

Please refer to the test suite for more details.

const env = require('@salestrip/env')

// access process.env.NODE_ENV
const NODE_ENV = env.get('NODE_ENV')

// sets FOO_BAR to 'whatever' if process.env.FOO_BAR is undefined
const FOO_BAR = env.get('FOO_BAR', 'whatever')

// sets FOO_BAR and process.env.FOO_BAR to 'whatever'
const FOO_BAR = env.set('FOO_BAR', 'whatever')

// deletes process.env.FOO_BAR and returns undefined
env.set('FOO_BAR')

// sets FOO_BAR and process.env.FOO_BAR to 'whatever' if process.env.FOO_BAR is undefined
const FOO_BAR = env.ensure('FOO_BAR', 'whatever')

// if process.env.FOO_BAR is 'something' sets FOO_BAR to 'something' (ignores fallback value)
const FOO_BAR = env.ensure('FOO_BAR', 'whatever')

// sets DB_URL and throws helpful error if process.env.DB_URL is undefined
const DB_URL = env.need('DB_URL')

Release

To release a new version, use npm. Using npm version will update the version in package.json before committing the resulting file change to git and adding the appropriate git tag. Pushing a tagged version to origin will trigger a CI deployment to the npm registry.

To release a bugfix update the patch version.

npm version patch
git push
git push --tags

To release a feature update the minor version.

npm version minor
git push
git push --tags

To release a breaking change update the major version.

npm version major
git push
git push --tags

License

Copyright © 2018-2019 SalesTrip Limited. All rights reserved.

Keywords

FAQs

Package last updated on 31 Jul 2019

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