code: function replace(str, env, escaping, convert, strict) {
    if(!str) return str;
    var re = /(\\?)(\$\{?)(\w+)(\}?)/g;
    if(!re.test(str)) return str;
    env = env || process.env;
    escaping = escaping === undefined ? true : escaping;
    if(!convert) {
      convert = function(value){return value};
    }
    str = str.replace(re, function(
      match, backslash, prefix, name, suffix, offset, string) {
      if(backslash && env[name]) {
        if(escaping) {
          return prefix + name + suffix;
        }
      }
      if(!env[name] && backslash && escaping) {
        return prefix + name + suffix;
      }
      if(env[name]) {
        if(!escaping && backslash) {
          return backslash + convert(env[name]);
        }
        return convert(env[name]);
      }else if(strict) {
        throw new Error(
          'environment variable replace could not locate variable: ' + name)
      }
      return match;
    })
    return str;
  }
docs: Performs substitution of environment variables within
  strings. The substitution format is:
  
  $variable or ${variable}
  
  @param str The target string value.
  @param env An object containing environment variables
  default is process.env.
  @param escaping Whether escaped dollars indicate replacement
  should be ignored.
  @param convert A conversion function used to convert the value
  to a string value before replacement.
  @param strict Throw an error if a replacement does not match an
  environment variable.