JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q40347F

Environment variable management

Package Exports

  • cli-env

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cli-env) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Environment

Environment variable management.

Install

npm install cli-env

Test

npm test

Examples

Manage a set of prefixed variables:

var env = require('..')({prefix: 'pkg'});
env.set('directory', '/usr/local/packages');
console.log(env.directory);
console.log(env.get('directory'));
console.log(process.env.pkg_directory);

Import all environment variables:

var env = require('..')({prefix: false, initialize: true});
for(var z in env) {
  console.log(z + '=%s', env[z]);               // => camelcase keys
}

Import a subset of environment variables matching a regular expression:

var env = require('..')({prefix: false, initialize: true, match: /^lc/i});
for(var z in env) {
  console.log(env.getKey(z) + '=%s', env[z]);   // => lowercase+underscore
}

License

Everything is MIT. Read the license if you feel inclined.