@naxmefy/env
v3.0.1
Published
env vars util
Downloads
4
Readme
@naxmefy/env
Type declarations included
Installation
$ npm install --save @naxmefy/env
Usage
import env from '@naxmefy/env'
const NodeEnv: string = env('NODE_ENV', 'development')
const aNumber: number = env('A_NUMBER', '10', Number)
const hello: string = env('USERNAME', 'John', v => `Hello ${v}!`)
glob method
import {glob} from '@naxmefy/env'
// e.g.:
interface IDBVars {
DB_URL?: string
DB_USER?: string
}
// load vars
const dbVars = glob('DB_*') as IDBVars
// e.g.:
console.log(dbVars.DB_URL)
console.log(dbVars.DB_USER)
Support for Node.js <= 4
Use Versions 1.x.x
Support for Node.js 5.x
Use Versions 2.x.x