1.0.0 • Published 2 years ago

env-var-parser v1.0.0

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

MIT License NPM NPMenv-var-parser CI

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 is undefined. That moved me to create this simple wrapper for process.env that solves all of the problems I had with process.env.

process.env wrapper with type support.

Use-cases:

  1. Type support for the environment variable
const variable = parseEnv<string>("ENV_VARIABLE");
  1. Default value in case environment variable is undefined.
const variable = parseEnv<number>("ENV_VARIABLE", 3);

Authors

License

MIT