Use arrow function to take advantage of bound context

This commit is contained in:
Daniel García Aubert 2017-09-15 14:26:22 +02:00
parent 90c4796d4e
commit 1959a841fd

View File

@ -21,8 +21,7 @@ function getPGTypeName (pgType) {
module.exports = class BaseDataview { module.exports = class BaseDataview {
getResult (psql, override, callback) { getResult (psql, override, callback) {
const self = this; this.sql(psql, override, (err, query) => {
this.sql(psql, override, function(err, query) {
if (err) { if (err) {
return callback(err); return callback(err);
} }
@ -32,8 +31,8 @@ module.exports = class BaseDataview {
return callback(err, result); return callback(err, result);
} }
result = self.format(result, override); result = this.format(result, override);
result.type = self.getType(); result.type = this.getType();
return callback(null, result); return callback(null, result);