Here you can find the source of interpolate(replacements)
String.prototype.interpolate = function (replacements) { return this.replace(/\{(\w+)\}/g, function (match, capture) { if (replacements[capture]) { return replacements[capture]; }// ww w. j av a2 s.c om else { return match; } }); };
String.prototype.interpolate = function (o) { if(o != undefined){ return this.replace( /{{([^{{}}]*)}}/g, function (a, b) { var r = o[b]; return typeof r === 'string' || typeof r === 'number' ? r : a; ); return this.toString(); };
String.prototype.interpolate = function (o) { return this.replace(/%\{([^\{\}]*)\}/g, function (a, b) { var r = o[b]; return typeof r === 'string' || typeof r === 'number' ? r : a; ); };
String.prototype.interpolate = function (o) { return this.replace(/{([^{}]*)}/g, function (a, b) { var r = o[b]; return typeof r === 'string' || typeof r === 'number' ? r : a; ); };
String.prototype.interpolate = function(props) { return this.replace(/\{\{(\w+)\}\}/g, function(match, expr) { return (props || window)[expr]; }); };
String.prototype.interpolate = function(props) { return this.replace(/\{(\w+)\}/g, function(match, expr) { return (props || window)[expr]; }); };