mirror of
https://github.com/swc-project/swc.git
synced 2024-12-21 12:41:54 +03:00
23 lines
531 B
JavaScript
23 lines
531 B
JavaScript
function _defineProperty(obj, key, value) {
|
|
if (key in obj) {
|
|
Object.defineProperty(obj, key, {
|
|
value: value,
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
} else {
|
|
obj[key] = value;
|
|
}
|
|
return obj;
|
|
}
|
|
// @target: es5,esnext
|
|
var a = "a";
|
|
var b = "b";
|
|
var _obj;
|
|
var ref = function() {
|
|
return _obj = {
|
|
}, _defineProperty(_obj, a, 1), _defineProperty(_obj, b, 1), _obj;
|
|
}(), aVal = ref[a], bVal = ref[b];
|
|
console.log(aVal, bVal);
|