1.0.0 • Published 2 years ago
env-var-parser v1.0.0
env-var-parser
MOTIVATION: Every time I use
process.env
in node project with typescript I always run into type issues. I also needed to handle edge cases where the environment isundefined
. That moved me to create this simple wrapper forprocess.env
that solves all of the problems I had withprocess.env
.
process.env
wrapper with type support.
Use-cases:
- Type support for the environment variable
const variable = parseEnv<string>("ENV_VARIABLE");
- Default value in case environment variable is undefined.
const variable = parseEnv<number>("ENV_VARIABLE", 3);