mic-inspector
Version:
A react inspector which a most similar of Chorme DevTools inspector
43 lines (42 loc) • 1.61 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NamedDescriptor = void 0;
var types_1 = require("./types");
var locale_1 = require("./locale");
/**
* Named property descriptor
*/
var NamedDescriptor = /** @class */ (function () {
function NamedDescriptor(owner, name, arg1, arg2, enumerable, configurable) {
if (enumerable === void 0) { enumerable = true; }
if (configurable === void 0) { configurable = true; }
this.owner = owner;
this.name = name;
this.fullname = name.toString();
this.nameType = locale_1.getNameType(name);
this.enumerable = enumerable;
this.configurable = configurable;
// if the property has accessor
if (typeof arg1 === 'function' && typeof arg2 !== 'number') {
this.value = void 0;
this.get = arg1;
this.set = arg2;
this.valueType = types_1.DescriptorValueType.Normal;
return;
}
var vt = arg2;
// if the property value type is a getter
if ((vt & types_1.DescriptorValueType.Getter) === types_1.DescriptorValueType.Getter) {
this.fullname = "get " + this.fullname;
}
// if the property value type is a setter
else if ((vt & types_1.DescriptorValueType.Setter) === types_1.DescriptorValueType.Setter) {
this.fullname = "set " + this.fullname;
}
this.value = arg1;
this.get = this.set = void 0;
this.valueType = vt;
}
return NamedDescriptor;
}());
exports.NamedDescriptor = NamedDescriptor;