Track environment variable usage
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
README.md
component.json
index.js
package.json

README.md

envs

Track environment variable usage

Usage

var envs = require('envs');

// enable tracing
envs.trace = true;

console.log(envs('NODE_ENV'));
// "production"

console.log(envs('NONEXISTANT', 'my default value'));
// "my default value"

console.log(envs.usages);
// { NODE_ENV: 
//   [ { lineno: '/Users/cameron/Projects/misc/envs/example.js:3:13',
//       defaultVal: undefined,
//       val: 'production' } ],
//  NONEXISTANT: 
//   [ { lineno: '/Users/cameron/Projects/misc/envs/example.js:6:13',
//       defaultVal: 'my default value',
//       val: 'my default value' } ] }

Testing

$ npm test