mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-14 22:38:30 +03:00
change linter to standard
This commit is contained in:
@@ -3,51 +3,51 @@
|
||||
*
|
||||
*/
|
||||
class Controller {
|
||||
constructor(fetchers) {
|
||||
this.fetchers = fetchers;
|
||||
constructor (fetchers) {
|
||||
this.fetchers = fetchers
|
||||
}
|
||||
|
||||
sourceExists(source) {
|
||||
sourceExists (source) {
|
||||
return (Object.keys(this.fetchers).indexOf(source) >= 0)
|
||||
}
|
||||
|
||||
blueprints() {
|
||||
blueprints () {
|
||||
return Object.keys(this.fetchers).map(
|
||||
source => this.fetchers[source].blueprints
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
update() {
|
||||
update () {
|
||||
return Promise.all(
|
||||
Object.keys(this.fetchers).map(source => {
|
||||
return this.fetchers[source].update();
|
||||
return this.fetchers[source].update()
|
||||
})
|
||||
).then(results => {
|
||||
return "All sources updated";
|
||||
});
|
||||
return 'All sources updated'
|
||||
})
|
||||
}
|
||||
|
||||
retrieve(source, tab, resource) {
|
||||
retrieve (source, tab, resource) {
|
||||
if (this.sourceExists(source)) {
|
||||
const fetcher = this.fetchers[source];
|
||||
return fetcher.retrieve(tab, resource);
|
||||
const fetcher = this.fetchers[source]
|
||||
return fetcher.retrieve(tab, resource)
|
||||
} else {
|
||||
return Promise.resolve().then(() => {
|
||||
throw new Error(`Source ${source} not available.`);
|
||||
});
|
||||
throw new Error(`Source ${source} not available.`)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
retrieveFrag(source, tab, resource, frag) {
|
||||
retrieveFrag (source, tab, resource, frag) {
|
||||
if (this.sourceExists(source)) {
|
||||
const fetcher = this.fetchers[source];
|
||||
return fetcher.retrieveFrag(tab, resource, frag);
|
||||
const fetcher = this.fetchers[source]
|
||||
return fetcher.retrieveFrag(tab, resource, frag)
|
||||
} else {
|
||||
return Promise.resolve().then(() => {
|
||||
throw new Error(`Source ${source} not available.`);
|
||||
});
|
||||
throw new Error(`Source ${source} not available.`)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Controller;
|
||||
export default Controller
|
||||
|
||||
Reference in New Issue
Block a user