change linter to standard

This commit is contained in:
Unknown
2018-11-12 10:28:59 +00:00
parent 19f3edf55a
commit 04d80c7c2f
19 changed files with 837 additions and 691 deletions

View File

@@ -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