env-allowed
Whether an environment variable's value is contained within an allow list. Allow list is provided by a comma-separated environment variable value.
$ npm install env-allowed --save
Example
node
or your program with a value that is in the allow list.
Start NODE_ENV=developent node
Create a comma-separated allow list.
process.env.ENVIRONMENTS = 'development,test';
NODE_ENV
is within the allow list.
Validate that the current allowed('ENVIRONMENTS');
// true