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.

106 lines (105 loc) • 3.34 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import 'reflect-metadata'; import { Expose, Type } from 'class-transformer'; import ClrMamePro from './clrMamePro.js'; /** * Metadata for a {@link DAT}. */ export default class Header { name; description; version; date; author; url; comment; clrMamePro; constructor(options) { this.name = options?.name ?? ''; this.description = options?.description; this.version = options?.version; this.date = options?.date; this.author = options?.author; this.url = options?.url; this.comment = options?.comment; this.clrMamePro = options?.clrMamePro; } /** * Create an XML object, to be used by the owning {@link DAT}. */ toXmlDatObj() { return Object.fromEntries(Object.entries({ name: this.name, description: this.description, version: this.version, date: this.date, author: this.author, url: this.url, comment: this.comment, }).filter(([, val]) => val !== undefined)); } // Property getters getName() { return this.name; } getDescription() { return this.description; } getVersion() { return this.version; } getComment() { return this.comment; } getClrMamePro() { return this.clrMamePro; } // Computed getters /** * Return a string representation of this {@link Header}. */ toString() { return JSON.stringify(this, undefined, 2); } } __decorate([ Expose({ name: 'name' }), __metadata("design:type", String) ], Header.prototype, "name", void 0); __decorate([ Expose({ name: 'description' }), __metadata("design:type", String) ], Header.prototype, "description", void 0); __decorate([ Expose({ name: 'version' }), __metadata("design:type", String) ], Header.prototype, "version", void 0); __decorate([ Expose({ name: 'date' }), __metadata("design:type", String) ], Header.prototype, "date", void 0); __decorate([ Expose({ name: 'author' }), __metadata("design:type", String) ], Header.prototype, "author", void 0); __decorate([ Expose({ name: 'url' }), __metadata("design:type", String) ], Header.prototype, "url", void 0); __decorate([ Expose({ name: 'comment' }), __metadata("design:type", String) ], Header.prototype, "comment", void 0); __decorate([ Type(() => ClrMamePro), Expose({ name: 'clrmamepro' }), __metadata("design:type", ClrMamePro) ], Header.prototype, "clrMamePro", void 0);