Use destructuring assignment to improve readability

This commit is contained in:
Daniel García Aubert 2017-09-15 14:07:46 +02:00
parent d5d9044686
commit ef5049f28f

View File

@ -9,10 +9,12 @@ module.exports = class DataviewFactory {
}
static getDataview (query, dataviewDefinition) {
const type = dataviewDefinition.type;
const { type, options, sql } = dataviewDefinition;
if (!this.dataviews[type]) {
throw new Error('Invalid dataview type: "' + type + '"');
}
return new this.dataviews[type](query, dataviewDefinition.options, dataviewDefinition.sql);
return new this.dataviews[type](query, options, sql);
}
};