You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/website/source/assets/javascripts/lib/_String.substitute.js

15 lines
336 B

(function(String){
if (String.prototype.substitute) {
return;
}
String.prototype.substitute = function(object, regexp){
return String(this).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
if (match.charAt(0) == '\\') return match.slice(1);
return (object[name] !== null) ? object[name] : '';
});
};
})(String);