Use a set/dict for checking the existence

This commit is contained in:
Daniel García Aubert 2017-06-08 18:38:44 +02:00
parent 0d4ac64f00
commit 2772fc62d2

View File

@ -20,7 +20,15 @@ function DataviewBackend(analysisBackend) {
this.analysisBackend = analysisBackend;
}
var DATE_AGGREGATIONS = ['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'];
var DATE_AGGREGATIONS = {
'minute': true,
'hour': true,
'day': true,
'week': true,
'month': true,
'quarter': true,
'year': true
};
module.exports = DataviewBackend;
@ -108,7 +116,7 @@ function getOverrideParams(params, ownFilter) {
{ownFilter: ownFilter}
);
if (params.aggregation && DATE_AGGREGATIONS.indexOf(params.aggregation) !== -1) {
if (params.aggregation && DATE_AGGREGATIONS.hasOwnProperty(params.aggregation)) {
overrideParams.aggregation = params.aggregation;
}