New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

getenv.ts

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

getenv.ts

Get and typecast environment variables with TypeScript

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-81.25%
Maintainers
1
Weekly downloads
 
Created
Source

getenv.ts

Helper to get and typecast environment variables with TypeScript.

:warning: Alpha

This library is still in alpha stages and is subject to change. The intention is to get the API up to par with getenv, but a lot is lacking and bugs are probable.

To do:

  • .boolish
  • .array
  • .multi
  • .url
  • .(enable/disable)Fallbacks
  • .(enable/disable)Errors
  • Full devops
  • Full test coverage
  • Full documentation
  • vue-cli compatability

Installation

yarn add getenv.ts

npm install getenv.ts

Usage

Set environment variables:

export HTTP_HOST="localhost"
export HTTP_PORT=8080
export HTTP_SECURE=true
export AB_TEST_RATIO=0.5

Get and use them:

import getenv from "getenv.ts";

const host = getenv("HTTP_HOST"); // Same as `getenv.string("HTTP_HOST");`
const port = getenv.int("HTTP_PORT");
const secure = getenv.bool("HTTP_SECURE");
const abTestRatio = getenv.float("AB_TEST_RATIO");

FAQs

Package last updated on 21 Sep 2018

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