simplify define property by using a helper in playground object getter memoization
This commit is contained in:
@@ -5,60 +5,24 @@ var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var _defineProperty = function (obj, key, value) {
|
||||
return Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
};
|
||||
|
||||
var Foo = function Foo() {};
|
||||
|
||||
_prototypeProperties(Foo, null, (function (_ref) {
|
||||
_ref[bar] = {
|
||||
get: function () {
|
||||
return Object.defineProperty(this, bar, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: complex()
|
||||
})[bar];
|
||||
},
|
||||
enumerable: true
|
||||
};
|
||||
return _ref;
|
||||
})({
|
||||
bar: {
|
||||
get: function () {
|
||||
return Object.defineProperty(this, "bar", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: complex()
|
||||
}).bar;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
_prototypeProperties(Foo, null, _defineProperty({}, bar, {
|
||||
get: function () {
|
||||
return _defineProperty(this, bar, complex())[bar];
|
||||
},
|
||||
enumerable: true
|
||||
}));
|
||||
|
||||
var foo = (function (_foo) {
|
||||
_foo[bar] = function () {
|
||||
return Object.defineProperty(this, bar, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: complex()
|
||||
})[bar];
|
||||
};
|
||||
|
||||
return _foo;
|
||||
})((function (_ref2) {
|
||||
Object.defineProperties(_ref2, {
|
||||
bar: {
|
||||
get: function () {
|
||||
return Object.defineProperty(this, "bar", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: complex()
|
||||
}).bar;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
|
||||
return _ref2;
|
||||
})({}));
|
||||
var foo = _defineProperty({}, bar, function () {
|
||||
return _defineProperty(this, bar, complex())[bar];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user