vue-di-kit
Version:
Vue Dependency Injection Kit
37 lines • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var argumenter_1 = require("@joejukan/argumenter");
var Property = /** @class */ (function () {
function Property() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this.required = false;
var argue = new argumenter_1.Argumenter(args);
this.type = argue.function;
var options = argue.object;
Object.assign(this, options);
this.setValue(this.default);
}
Property.prototype.setValue = function (value) {
if (!/null|undefined/.test(typeof value)) {
this.default = value;
if (!this.type) {
if (typeof value === 'string')
this.type = String;
else if (typeof value === 'number')
this.type = Number;
else if (typeof value === 'boolean')
this.type = Boolean;
else if (Array.isArray(value))
this.type = Array;
else if (typeof value === 'object')
this.type = value['constructor'];
}
}
};
return Property;
}());
exports.Property = Property;
//# sourceMappingURL=property.js.map