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.
40 lines (39 loc) • 986 B
JavaScript
import Game from './game.js';
/**
* A {@link Game} that
*/
export default class SingleValueGame extends Game {
region;
language;
category;
constructor(props) {
super(props);
this.region = props.region;
this.language = props.language;
this.category = props.category;
}
getRegion() {
return this.region ?? super.getRegions().at(0);
}
getRegions() {
return this.region ? [this.region] : super.getRegions();
}
getLanguage() {
return this.language ?? super.getLanguages().at(0);
}
getLanguages() {
return this.language ? [this.language] : super.getLanguages();
}
getCategory() {
return this.category ?? super.getCategories().at(0);
}
getCategories() {
return this.category ? [this.category] : super.getCategories();
}
withProps(props) {
return new SingleValueGame({
...this,
...props,
});
}
}