UNPKG

@slash-tmp/rgaa-scraper

Version:

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

28 lines 1.1 kB
import RgaaTestWrapper from './RgaaTestWrapper'; import RgaaTopicWrapper from './RgaaTopicWrapper'; import { RgaaRootWrapper } from './RgaaRootWrapper'; import { filterElements } from './utils'; export default class RgaaCriterionWrapper extends 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( // 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(filterElements(filters)) .map(test => new RgaaTestWrapper(test, this._root)); } } //# sourceMappingURL=RgaaCriterionWrapper.js.map