Skip to main content

Practice ยท 1 of 2

Env Reader with Fail-Fast

Write readEnv(env, required) โ€” env is a plain object standing in for process.env; required is an array of key names. Return the full env object, but throw an Error naming EVERY missing key (comma-separated) instead of failing later at runtime. Missing means absent, empty string, or undefined.

Difficulty: intermediate

Back to lesson: Practice: Environment Configuration โ€” Practice