Use const instead of var to declare variables

This commit is contained in:
Daniel García Aubert 2017-09-15 11:35:06 +02:00
parent 9771979b8f
commit c7ed3d34e8

View File

@ -1,5 +1,5 @@
var BaseDataview = require('./base');
var debug = require('debug')('windshaft:dataview:formula');
const BaseDataview = require('./base');
const debug = require('debug')('windshaft:dataview:formula');
const countInfinitiesQueryTpl = ctx => `
SELECT count(1) FROM (${ctx._query}) __cdb_formula_infinities
@ -58,7 +58,7 @@ module.exports = class Formula extends BaseDataview {
}
if (!VALID_OPERATIONS[options.operation]) {
throw new Error(`Formula does not support '${options.operation}' operation`)
throw new Error(`Formula does not support '${options.operation}' operation`);
}
if (options.operation !== 'count' && typeof options.column !== 'string') {
@ -74,7 +74,7 @@ module.exports = class Formula extends BaseDataview {
sql (psql, override, callback) {
var self = this;
const self = this;
if (!callback) {
callback = override;
@ -92,7 +92,7 @@ module.exports = class Formula extends BaseDataview {
return null;
}
var formulaSql = formulaQueryTpl({
const formulaSql = formulaQueryTpl({
_isFloatColumn: this._isFloatColumn,
_query: this.query,
_operation: this.operation,
@ -123,7 +123,7 @@ module.exports = class Formula extends BaseDataview {
getType () {
return TYPE;
};
}
toString () {
return JSON.stringify({
@ -133,4 +133,4 @@ module.exports = class Formula extends BaseDataview {
_operation: this.operation
});
}
}
};