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; | |
}); | |
}; | |
}; |