Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getterSetter: function (name, getter, setter) {
getter = getter || _.identity;
setter = setter || _.identity;
return function () {
if (arguments.length) {
var newVal = setter.apply(this, arguments);
this.data[name] = newVal;
this.emit && this.emit(name, getter.call(this, newVal));
return this;
} else {
return getter.call(this, this.data[name]);
}
};
},
getterSetter: function (name, getter, setter) {
getter = getter || _.identity;
setter = setter || _.identity;
return function () {
if (arguments.length) {
var newVal = setter.apply(this, arguments);
this.data[name] = newVal;
this.emit && this.emit(name, getter.call(this, newVal));
return this;
} else {
return getter.call(this, this.data[name]);
}
};
},