3 ms·
function render(tpl,data){ var matches = tpl.match(/{[^\}]+}/g); for(var i in matches){ var rep = eval("data."+matches[i].replace(/[{}]/g,''));
by pfraze 14y ago
function render(tpl,data){
var matches = tpl.match(/{[^\}]+}/g);
for(var i in matches){
var rep = eval("data."+matches[i].replace(/[{}]/g,''));
tpl = tpl.replace(matches[i],rep);
}
return tpl;
}
Fixed