github.com/nicgrayson/terraform@v0.4.3-0.20150415203910-c4de50829380/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);