UNPKG

igir

Version:

🕹 A zero-setup ROM collection manager that sorts, filters, extracts or archives, patches, and reports on collections of any size on any OS.

76 lines (75 loc) • 2.12 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; import { Expose, plainToClassFromExist, Transform, Type } from "class-transformer"; import DAT from "../dat.js"; import Header from "../logiqx/header.js"; import Software from "./software.js"; const _SoftwareListDAT = class _SoftwareListDAT extends DAT { name; description; software; constructor(props) { super(props); this.software = props?.software; this.generateGameNamesToParents(); } /** * Construct a {@link SoftwareListDAT} from a generic object, such as one from reading an XML * file. */ static fromObject(obj, props) { const dat = new _SoftwareListDAT(props); return plainToClassFromExist(dat, obj, { enableImplicitConversion: true, excludeExtraneousValues: true }).generateGameNamesToParents(); } getHeader() { return new Header({ name: this.name, description: this.description }); } getGames() { if (this.software === void 0) { return []; } if (Array.isArray(this.software)) { return this.software; } return [this.software]; } /** * @inheritdoc */ isMame() { return true; } withGames(games) { return new _SoftwareListDAT({ ...this, software: games }); } }; __decorateClass([ Expose() ], _SoftwareListDAT.prototype, "name", 2); __decorateClass([ Expose() ], _SoftwareListDAT.prototype, "description", 2); __decorateClass([ Expose(), Type(() => Software), Transform(({ value }) => value ?? []) ], _SoftwareListDAT.prototype, "software", 2); let SoftwareListDAT = _SoftwareListDAT; export { SoftwareListDAT as default }; //# sourceMappingURL=softwareListDat.js.map