(function (global) { var Template = function (str) { this.template = str || ''; Object.defineProperties( this, { modifier: { writable: true, value: this._modifier } }); return this; } Object.defineProperties( Template.prototype, { _regex: { writable: false, value: /#{(((?!{).)*)}/g }, _modifier: { writable: false, value: function ( match, key ) { return this[key] || ''; } }, parse: { writable: false, value: function (data) { return this.template.replace(this._regex, this.modifier.bind(data)); } } }); global['Template'] = Template; }(this));