UNPKG

@slash-tmp/rgaa-scraper

Version:

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

30 lines 1.25 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 RgaaTestWrapper_1 = __importDefault(require("./RgaaTestWrapper")); const RgaaRootWrapper_1 = require("./RgaaRootWrapper"); const utils_1 = require("./utils"); class RgaaTopicWrapper extends RgaaRootWrapper_1.RgaaRootWrapper { constructor(data, root) { super(root); this.id = data.id; this.title = data.title; } criteria(filters) { return this._root.criteria .filter(criterion => criterion.id.startsWith(this.id)) .filter(utils_1.filterElements(filters)) .map(criterion => new RgaaCriterionWrapper_1.default(criterion, 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 = RgaaTopicWrapper; //# sourceMappingURL=RgaaTopicWrapper.js.map