src/utils.js
function getParsedEnvVar(varNameRoot) {
  const val = envVarBasedOnCIEnv(varNameRoot);
  const prefix = getEnvPrefix();
  const combinedVar = `${prefix}${varNameRoot}`;
  if (!val) {
    error(
      `${chalk.cyan(
        combinedVar,
      )} not found, make sure it is set within environment variables.`,
    );
  }
  try {
    if (isString(val)) {
      return JSON.parse(val);
    }
    return val;
  } catch (err) {
    error(`Error parsing ${combinedVar}`);
    return val;
  }
}
function getParsedEnvVar(varNameRoot) {
  const val = envVarBasedOnCIEnv(varNameRoot);
  const prefix = getEnvPrefix();
  const combinedVar = `${prefix}${varNameRoot}`;
  if (!val) {
    error(
      `${chalk.cyan(
        combinedVar,
      )} not found, make sure it is set within environment variables.`,
    );
  }
  try {
    if (isString(val)) {
      return JSON.parse(val);
    }
    return val;
  } catch (err) {
    error(`Error parsing ${combinedVar}`);
    return val;
  }
}
function getParsedEnvVar ( varNameRoot ) { const val = envVarBasedOnCIEnv ( varNameRoot ) ; const prefix = getEnvPrefix ( ) ; const combinedVar = ` ${ prefix } ${ varNameRoot } ` ; if ( ! val ) { error ( ` ${ chalk . cyan ( combinedVar , ) } ` , ) ; } try { if ( isString ( val ) ) { return JSON . parse ( val ) ; } return val ; } catch ( err ) { error ( ` ${ combinedVar } ` ) ; return val ; } }
Get parsed value of environment variable. Useful for environment variables
which have characters that need to be escaped.
@param  {String} varNameRoot - variable name without the environment prefix
@return {Any} Value of the environment variable
@example
getParsedEnvVar('FIREBASE_PRIVATE_KEY_ID')
// => 'fireadmin-stage' (parsed value of 'STAGE_FIREBASE_PRIVATE_KEY_ID' environment var)
Get parsed value of environment variable . Useful for environment variables which have characters that need to be escaped .