@slash-tmp/rgaa-scraper
Version:
Scrapes RGAA's website and fetch topics, criteria and tests into a JSON format.
34 lines • 1.43 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const RgaaTestWrapper_1 = __importDefault(require("./RgaaTestWrapper"));
const RgaaTopicWrapper_1 = __importDefault(require("./RgaaTopicWrapper"));
const RgaaRootWrapper_1 = require("./RgaaRootWrapper");
const utils_1 = require("./utils");
class RgaaCriterionWrapper extends RgaaRootWrapper_1.RgaaRootWrapper {
constructor(data, root) {
super(root);
this.id = data.id;
this.title = data.title;
this.references = data.references;
this.particularCases = data.particularCases;
this.technicalNotes = data.technicalNotes;
this.level = data.level;
}
get topic() {
const topicId = this.id.split('.')[0];
return new RgaaTopicWrapper_1.default(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this._root.topics.find(topic => topic.id === topicId), this._root);
}
tests(filters) {
return this._root.tests
.filter(test => test.id.startsWith(this.id))
.filter(utils_1.filterElements(filters))
.map(test => new RgaaTestWrapper_1.default(test, this._root));
}
}
exports.default = RgaaCriterionWrapper;
//# sourceMappingURL=RgaaCriterionWrapper.js.map