@ostai/env

manage and get process.env

Stats

StarsIssuesVersionUpdatedCreatedSize
@ostai/env
001.1.08 months ago3 years agoMinified + gzip package size for @ostai/env in KB

Readme

Build Status Coverage

ostai-env

Manage and get process.env

Install

$ npm i @ostai/env

Usage

type Converter = (
  value: any,
  // The key of the env variable
  key: string,
  // If the env key does not exist, then `is_default` is true
  is_default: boolean
) => any

env(key: string, converter?: Converter | Array<Converter> | null, defaults?: any): any
  • key string environment key
  • converter? Converter | Array<Converter> | null the method to convert env value
  • defaults? any the default value if environment key is not found
const port = env('SERVER_PORT', env.integer, 80)

Converter functions

  • env.boolean which treats 'true' and '1' as true
  • env.integer
  • env.

License

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.