blob: c3a65801525b305ae86f2d491e9ad1d8b85e9346 [file] [log] [blame]
bigbiffd006b302015-03-06 18:36:03 -05001module.exports = function Templater(){
2 var self = this;
3
4 var templatePattern = /\{(.*?)\}/g;
5
6 self.setTemplatePattern = function(newTemplatePattern){
7 templatePattern = newTemplatePattern;
8 };
9
10 self.render = function(t, data){
11 return t.replace(templatePattern, function(match, prop) {
12 return data[prop] || match;
13 });
14 };
15};