Use arrow function

This commit is contained in:
Daniel García Aubert
2017-09-11 19:09:05 +02:00
parent 09981c2560
commit ee43378c68
@@ -187,7 +187,7 @@ module.exports = class DateHistogram extends BaseHistogram {
}
_buildQuery (psql, override, callback) {
if (!this.isValidAggregation(override)) {
if (!this._isValidAggregation(override)) {
return callback(new Error('Invalid aggregation value. Valid ones: ' +
Object.keys(DATE_AGGREGATIONS).join(', ')
));
@@ -238,13 +238,8 @@ module.exports = class DateHistogram extends BaseHistogram {
const aggegations = result.rows[0];
const aggregation = Object.keys(aggegations)
.map(function (key) {
return {
name: key,
value: aggegations[key]
};
})
.reduce(function (closer, current) {
.map(key => ({ name: key, value: aggegations[key] }))
.reduce((closer, current) => {
if (current.value > MAX_INTERVAL_VALUE) {
return closer;
}