get-env-variable
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Get environment variable

A dead simple package for getting environment variables.

Getting started

Installation

npm i get-env-variable

Usage

Both export and default export are available

import { getEnvironmentVariable } from 'get-env-variable'

// With default value
// This will return 3000 if PORT environment variable does not exists
const PORT = Number(getEnvironmentVariable('PORT', '3000'))

// Without default value
// This will throw error if PORT environment variable does not exists
const PORT = Number(getEnvironmentVariable('PORT'))

Package Sidebar

Install

npm i get-env-variable

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

14.5 kB

Total Files

7

Last publish

Collaborators

  • malware-moon