github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/website/source/assets/javascripts/lib/String.substitute.js (about)

     1  (function(String){
     2  
     3  if (String.prototype.substitute) {
     4  	return;
     5  }
     6  
     7  String.prototype.substitute = function(object, regexp){
     8  	return String(this).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
     9  		if (match.charAt(0) == '\\') return match.slice(1);
    10  		return (object[name] !== null) ? object[name] : '';
    11  	});
    12  };
    13  
    14  })(String);