@helper-modules/env

1.0.3 • Public • Published

@helper-modules/env

Allows to Access Environment Variables Easily

Installation

npm i @helper-modules/env

Usage

Syntex

env(key: String, filter: Boolean);
  • Params:
    • key:
      • type: String
      • default: undefined
    • filter:
      • type: Boolean
      • default: true
      • usage: Allows to filter threw values

Common Usage

  • .env
name=Jhon
  • index.js
const env = require("@helper-modules/env");
// or
const { env } = require("@helper-modules/all");

let name = env("name");

console.log(name); // Jhon

filter Param

  • .env
logging=false
  • index.js

With Filter

...

let logging = env("logging");

console.log(logging) // false
console.log(typeof logging) // 'boolean'

Without Filter

...

let logging = env("logging", false);

console.log(logging) // 'false'
console.log(typeof logging) // 'string'
  • Filterable Values
    • 'false': false
    • 'true': true
    • 'undefined': undefined
    • 'null': null

Package Sidebar

Install

npm i @helper-modules/env

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

2.92 kB

Total Files

7

Last publish

Collaborators

  • helper-modules