load-env-var
v0.5.2
Published
A helper module for loading environment variables
Downloads
47
Maintainers
Readme
A helper module for loading environment variables
Install
$ npm i load-env-var
Usage
Import
const envLoader = require("load-env-var");
// or
import envLoader from "load-env-var";
Load Number
envLoader.loadNumber("PORT", {
allowNaN: false,
allowInfinity: false,
defaultValue: 5000,
});
Load String
envLoader.loadString("JWT_SERCRET", {
defaultValue: "thiskeyissecret",
});
Load Array
envLoader.loadArray("NAMES", {
type: "string",
delimiter: ",",
});
Load Boolean
envLoader.loadBoolean("ALLOW_HTTP", {
defaultValue: false,
});