Merge pull request #6 from LeRoid-hub/1-custom-data-structure-or-generic-for-bundesland

data structure bl
This commit is contained in:
LeRoid-hub 2023-12-23 21:37:09 +01:00 committed by GitHub
commit 519b9ea6cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,18 +2,18 @@ import * as cheerio from 'cheerio';
class Campus { class Campus {
name: string; name: string;
mensen: Mensa[]; locations: Mensa[];
constructor(name: string) { constructor(name: string) {
this.name = name; this.name = name;
this.mensen = []; this.locations = [];
} }
addMensa(mensa: Mensa) { addMensa(mensa: Mensa) {
this.mensen.push(mensa); this.locations.push(mensa);
} }
toString() { toString() {
let str = this.name + "\n"; let str = this.name + "\n";
this.mensen.forEach((elem) => { this.locations.forEach((elem) => {
str += " -> " + elem.name + " | " + elem.url + "\n"; str += " -> " + elem.name + " | " + elem.url + "\n";
}); });
return str; return str;