index.js
function get(path, defaultValue, opts) {
  let obj;
  const args = [].slice.call(arguments);
  path = args.shift();
  if (typeof args[args.length - 1] === 'object') {
    opts = args.pop();
  } else {
    opts = {};
  }
  defaultValue = args.pop();

  keys(path, opts)
    .sort((a, b) => a.length - b.length)
    .forEach(key => {
      let dotp = toDot(key, opts);
      if (!opts.caseSensitive) {
        dotp = dotp.toLowerCase();
      }
      const val = parse(process.env[key], opts);
      if (dotp === '') {
        obj = val;
      } else {
        if (typeof obj !== 'object') {
          obj = {};
        }
        dotProp.set(obj, dotp, val);
      }
    });

  let prefix = path;
  if (!opts.caseSensitive) {
    prefix = prefix.toLowerCase();
  }
  if (path === '') {
    return obj;
  }
  return dotProp.get(obj, prefix, defaultValue);
}
function get(path, defaultValue, opts) {
  let obj;
  const args = [].slice.call(arguments);
  path = args.shift();
  if (typeof args[args.length - 1] === 'object') {
    opts = args.pop();
  } else {
    opts = {};
  }
  defaultValue = args.pop();

  keys(path, opts)
    .sort((a, b) => a.length - b.length)
    .forEach(key => {
      let dotp = toDot(key, opts);
      if (!opts.caseSensitive) {
        dotp = dotp.toLowerCase();
      }
      const val = parse(process.env[key], opts);
      if (dotp === '') {
        obj = val;
      } else {
        if (typeof obj !== 'object') {
          obj = {};
        }
        dotProp.set(obj, dotp, val);
      }
    });

  let prefix = path;
  if (!opts.caseSensitive) {
    prefix = prefix.toLowerCase();
  }
  if (path === '') {
    return obj;
  }
  return dotProp.get(obj, prefix, defaultValue);
}
function get ( path , defaultValue , opts ) { let obj ; const args = [ ] . slice . call ( arguments ) ; path = args . shift ( ) ; if ( typeof args [ args . length - 1 ] === 'object' ) { opts = args . pop ( ) ; } else { opts = { } ; } defaultValue = args . pop ( ) ; keys ( path , opts ) . sort ( ( a , b ) => a . length - b . length ) . forEach ( key => { let dotp = toDot ( key , opts ) ; if ( ! opts . caseSensitive ) { dotp = dotp . toLowerCase ( ) ; } const val = parse ( process . env [ key ] , opts ) ; if ( dotp === '' ) { obj = val ; } else { if ( typeof obj !== 'object' ) { obj = { } ; } dotProp . set ( obj , dotp , val ) ; } } ) ; let prefix = path ; if ( ! opts . caseSensitive ) { prefix = prefix . toLowerCase ( ) ; } if ( path === '' ) { return obj ; } return dotProp . get ( obj , prefix , defaultValue ) ; }
Gets the values of environment variables at the path specified.
@public
@param  {string} path Dot separated path.
@param  {any} [defaultValue=undefined] Default value to return if there is
not any environment variable that matches the path provided.
@param  {Object} [opts] Additional options.
@param  {boolean} [opts.parse=false] If true the value retrieved is converted
to the proper type.
@param  {boolean} [opts.caseSensitive=false] If true no case conversion will
be performed from the dot path provided to the env key search.
Eg: 'tesT.kEy' will look for tesT_kEy environment variable instead of TEST_KEY.
@return {any} The values of environment variables associated with the path specified.
Gets the values of environment variables at the path specified .