Use destructuring assignment to improve readability
This commit is contained in:
parent
d5d9044686
commit
ef5049f28f
@ -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);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user