1.0.3 • Published 4 years ago
@helper-modules/env v1.0.3
@helper-modules/env
Allows to Access Environment Variables Easily
Installation
npm i @helper-modules/envUsage
Syntex
env(key: String, filter: Boolean);- Params:
key:- type:
String - default:
undefined
- type:
filter:- type:
Boolean - default:
true - usage: Allows to filter threw values
- type:
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); // Jhonfilter 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