var Template = (function() {
var instance = null,
Template = function() {
this._regexp = //{([^/}]*)/}/gi;
};
Template.prototype.replace = function(template, object) {
return template.replace(this._regexp, function($1, $2){
try {
if (object[$2] !== undefined) {
return object[$2];
} else {
//console.error(object + ' not ' + $2 + ' property!');
return null;
}
} catch (e) {
//console.error('Not object');
}
});
};
return {
lazyInit: function() {
return instance = instance === null ? new Template() : instance;
}
};
}());