blob: c3a65801525b305ae86f2d491e9ad1d8b85e9346 [file] [log] [blame]
module.exports = function Templater(){
var self = this;
var templatePattern = /\{(.*?)\}/g;
self.setTemplatePattern = function(newTemplatePattern){
templatePattern = newTemplatePattern;
};
self.render = function(t, data){
return t.replace(templatePattern, function(match, prop) {
return data[prop] || match;
});
};
};