@ansaro/validate-env

Validate environment variables in Node.js

Usage no npm install needed!

<script type="module">
  import ansaroValidateEnv from 'https://cdn.skypack.dev/@ansaro/validate-env';
</script>

README

validate-env CircleCI codecov

Validate environment variables in Node.js

require("@ansaro/validate-env")(["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"])

Pass an array of strings you want to make sure exist in process.env. An error will be thrown listing any that are missing unless process.env.NODE_ENV is set to test. This allows you to easily test your code without needing to mock or stub this module.