Fix jshint style errors

This commit is contained in:
Simon 2017-09-08 16:09:57 +02:00
parent 5e07cc2ad1
commit 92f6f59e07

View File

@ -2,32 +2,35 @@ const debug = require('debug')('windshaft:dataview:histogram');
const NumericHistogram = require('./numeric-histogram');
const DateHistogram = require('./date-histogram');
const TYPE = 'histogram';
const DATE_HISTOGRAM = 'DateHistogram';
const NUMERIC_HISTOGRAM = 'NumericHistogram';
module.exports = class Histogram {
constructor (query, options = {}, queries) {
constructor (query, options, queries) {
this.query = query;
this.options = options;
this.options = options ||{};
this.queries = queries;
this.dataview = this._getHistogramImplemetation();
}
_getHistogramImplemetation (override) {
let implementation = null;
switch (this._getHistogramSubtype(override)) {
case DATE_HISTOGRAM:
debug('Delegating to DateHistogram with options: %j and overriding: %j', this.options, override)
return new DateHistogram(this.query, this.options, this.queries);
debug('Delegating to DateHistogram with options: %j and overriding: %j', this.options, override);
implementation = new DateHistogram(this.query, this.options, this.queries);
break;
case NUMERIC_HISTOGRAM:
debug('Delegating to NumericHistogram with options: %j and overriding: %j', this.options, override)
return new NumericHistogram(this.query, this.options, this.queries);
debug('Delegating to NumericHistogram with options: %j and overriding: %j', this.options, override);
implementation = new NumericHistogram(this.query, this.options, this.queries);
break;
default:
throw new Error('Unsupported Histogram type');
}
return implementation;
}
_getHistogramSubtype (override = {}) {