UNPKG

@slash-tmp/rgaa-scraper

Version:

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

24 lines 913 B
import RgaaCriterionWrapper from './RgaaCriterionWrapper'; import RgaaTestWrapper from './RgaaTestWrapper'; import { RgaaRootWrapper } from './RgaaRootWrapper'; import { filterElements } from './utils'; export default class RgaaTopicWrapper extends 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(filterElements(filters)) .map(criterion => new RgaaCriterionWrapper(criterion, this._root)); } tests(filters) { return this._root.tests .filter(test => test.id.startsWith(this.id)) .filter(filterElements(filters)) .map(test => new RgaaTestWrapper(test, this._root)); } } //# sourceMappingURL=RgaaTopicWrapper.js.map