| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import { type_manager } from "./functions.js";
- import { submission } from "./submission.js";
- class submissions_list {
- #content;
- constructor() {
- this.#content = {};
- }
- append(target) {
- if (!(target instanceof submission)) {
- throw "New target on list must be instance of an submission.";
- }
- if (this.exists(target)) {
- throw "This submission already exists on list.";
- }
- this.#content[target.title] = target;
- }
- exists(target) {
- if (target instanceof submission) {
- target = target.title;
- }
- if (!(type_manager.is_string(target))) {
- throw "Target must be instance of string or submission.";
- }
- return this.#content.hasOwnProperty(target);
- }
- get(target) {
- if (!this.exists(target)) {
- throw "Submission with that name not exists in the list.";
- }
- return this.#content[target];
- }
- get content() {
- return Object.assign({}, this.#content);
- }
- }
- export { submissions_list };
|