UNPKG

@slash-tmp/rgaa-scraper

Version:

Scrapes RGAA's website and fetch topics, criteria and tests into a JSON format.

29 lines 1.28 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const RgaaCriterionWrapper_1 = __importDefault(require("./RgaaCriterionWrapper")); const RgaaTopicWrapper_1 = __importDefault(require("./RgaaTopicWrapper")); const RgaaRootWrapper_1 = require("./RgaaRootWrapper"); class RgaaTestWrapper extends RgaaRootWrapper_1.RgaaRootWrapper { constructor(data, root) { super(root); this.id = data.id; this.title = data.title; } get criterion() { const criterionId = this.id.split('.').slice(0, 2).join('.'); return new RgaaCriterionWrapper_1.default( // eslint-disable-next-line @typescript-eslint/no-non-null-assertion this._root.criteria.find(criterion => criterion.id === criterionId), this._root); } 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); } } exports.default = RgaaTestWrapper; //# sourceMappingURL=RgaaTestWrapper.js.map