1.0.3 • Published 1 year ago

get-env-variable v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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'))