export class product_base { name; description; author; barcode; stock_count; constructor(target = null) { this.name = this._extract(target, "name"); this.description = this._extract(target, "description"); this.author = this._extract(target, "author"); this.barcode = this._extract(target, "barcode"); this.stock_count = this._extract(target, "stock_count"); if (this.stock_count !== null) { this.stock_count = Number(this.stock_count); } } get dump() { return { "name": this.name, "description": this.description, "author": this.author, "barcode": this.barcode, "stock_count": this.stock_count } } _extract(dict, name) { if (dict === null) { return null; } if (name in dict) { return dict[name]; } return null; } get avairable() { return (this.stock_count > 0); } }