42-cent-model
Version:
Models to ease creation of 42-cent parameter entities
22 lines (19 loc) • 421 B
JavaScript
function setEventually(property) {
return function (value) {
maybe(function (val) {
this[property] = val;
}).call(this, value);
return this;
};
}
//simple one-arity maybe func
function maybe(func) {
return function (value) {
if (value !== undefined) {
func.call(this, value);
}
}
}
module.exports = {
"setEventually": setEventually
};