source-scraper-core
Version:
Core files for the SourceScraper-Project
30 lines • 935 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const lodash_flatmap_1 = require("lodash.flatmap");
class ScraperArray extends Array {
constructor(...args) {
super(...args);
}
get domains() {
return lodash_flatmap_1.default(this, s => s.domains);
}
getAllApplicable(url) {
return this.filter(s => s.isApplicable(url));
}
getFirstApplicable(url) {
return this.find(s => s.isApplicable(url));
}
allApplicable(url) {
return this.every(s => s.isApplicable(url));
}
getByName(name) {
name = name.toLowerCase();
return this.find(s => s.name.toLowerCase() === name);
}
getByDomain(domain) {
domain = domain.toLowerCase();
return this.find(s => s.isApplicableDomain(domain));
}
}
exports.ScraperArray = ScraperArray;
//# sourceMappingURL=ScraperArray.js.map