index.js
function env(environment) {
  environment = environment || {};

  if ('object' === typeof process && 'object' === typeof process.env) {
    env.merge(environment, process.env);
  }

  if ('undefined' !== typeof window) {
    if ('string' === window.name && window.name.length) {
      env.merge(environment, env.parse(window.name));
    }

    if (window.localStorage) {
      try { env.merge(environment, env.parse(window.localStorage.env || window.localStorage.debug)); }
      catch (e) {}
    }

    if (
         'object' === typeof window.location
      && 'string' === typeof window.location.hash
      && window.location.hash.length
    ) {
      env.merge(environment, env.parse(window.location.hash.charAt(0) === '#'
        ? window.location.hash.slice(1)
        : window.location.hash
      ));
    }
  }

  //
  // Also add lower case variants to the object for easy access.
  //
  var key, lower;
  for (key in environment) {
    lower = key.toLowerCase();

    if (!(lower in environment)) {
      environment[lower] = environment[key];
    }
  }

  return environment;
}
function env(environment) {
  environment = environment || {};

  if ('object' === typeof process && 'object' === typeof process.env) {
    env.merge(environment, process.env);
  }

  if ('undefined' !== typeof window) {
    if ('string' === window.name && window.name.length) {
      env.merge(environment, env.parse(window.name));
    }

    if (window.localStorage) {
      try { env.merge(environment, env.parse(window.localStorage.env || window.localStorage.debug)); }
      catch (e) {}
    }

    if (
         'object' === typeof window.location
      && 'string' === typeof window.location.hash
      && window.location.hash.length
    ) {
      env.merge(environment, env.parse(window.location.hash.charAt(0) === '#'
        ? window.location.hash.slice(1)
        : window.location.hash
      ));
    }
  }

  //
  // Also add lower case variants to the object for easy access.
  //
  var key, lower;
  for (key in environment) {
    lower = key.toLowerCase();

    if (!(lower in environment)) {
      environment[lower] = environment[key];
    }
  }

  return environment;
}
function env ( environment ) { environment = environment || { } ; if ( 'object' === typeof process && 'object' === typeof process . env ) { env . merge ( environment , process . env ) ; } if ( 'undefined' !== typeof window ) { if ( 'string' === window . name && window . name . length ) { env . merge ( environment , env . parse ( window . name ) ) ; } if ( window . localStorage ) { try { env . merge ( environment , env . parse ( window . localStorage . env || window . localStorage . debug ) ) ; } catch ( e ) { } } if ( 'object' === typeof window . location && 'string' === typeof window . location . hash && window . location . hash . length ) { env . merge ( environment , env . parse ( window . location . hash . charAt ( 0 ) === '#' ? window . location . hash . slice ( 1 ) : window . location . hash ) ) ; } } // // Also add lower case variants to the object for easy access. // var key , lower ; for ( key in environment ) { lower = key . toLowerCase ( ) ; if ( ! ( lower in environment ) ) { environment [ lower ] = environment [ key ] ; } } return environment ; }
Gather environment variables from various locations.

@param {Object} environment The default environment variables.
@returns {Object} environment.
@api public
Gather environment variables from various locations .