Node.js examples for String:Template
String#interpolate(values, syntax) -> String
/**/*from w ww .jav a 2 s . co m*/ * String#interpolate(values, syntax) -> String * * Based on String#supplant() by Douglas Crawford: * * http://javascript.crockford.com/remedial.html * **/ if (!String.prototype.interpolate) { String.prototype.interpolate = function (values, syntax) { if (!syntax) syntax = /{([^{}]*)}/g return this.replace(syntax, function (a, b) { var r = values[b]; return typeof r === "string" || typeof r === "number" ? r : a; } ); } }