| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1 1 1 6 14 6 1 | define(function () {
var stache = /\{\{(\w+)\}\}/g; //mustache-like
/**
* String interpolation
* @version 0.1.0 (2012/03/05)
*/
function interpolate(template, replacements, syntax){
var replaceFn = function(match, prop){
return (prop in replacements)? replacements[prop] : '';
};
return template.replace(syntax || stache, replaceFn);
}
return interpolate;
});
|