var Utils={ template: function() { var args = arguments, result; if (args.length > 0) { if (typeof args[0] === "string") { result = args[0]; if (args.length == 2 && typeof args[1] == "object") { for (var key in args[1]) { if (args[1][key] != undefined) { var regkey = ((+key) == (+key)) ? "[" + key + "]" : key; var reg = new RegExp("({{" + regkey + "}})", "g"); result = result.replace(reg, args[1][key]); } } } var reg = new RegExp("({{.*}})", "g"); result = result.replace(reg, ''); } } return result; } } module.exports=Utils;