Node.js examples for String:Template
Template string
/** /*from w w w . j ava2s .c om*/ * Template string */ var Template = (function(){ return { 'parseItem' : function(tpl, source, destination){ return tpl.replace(new RegExp('[\{]' + source + '[\}]', 'g'), destination); }, 'parse' : function(tpl, source){ for(var i in source){ tpl = Template.parseItem(tpl, i, source[i]); } return tpl; } } })();