ref: http://jsperf.com/string-format-underscore-vs-hot
var template = {};
template.format = function(string, context){
return string.replace(/\{(\S+)\}/g), function(str, key){ return context[key]; });
};
// using
// template.format(“{x}”, { x: 1 });
// template.format(“{x}, {y}”, { x: 1, y: 2 });
but it will only supported “replace variable”
no more condition or loop in template string :p
useful for simple replace variable