From ffe2c15a65562836ab36f98bf907c3641f3c5302 Mon Sep 17 00:00:00 2001 From: Philipp Borgers Date: Mon, 21 Jan 2013 14:52:00 +0100 Subject: [PATCH] fix jshint errors for lib/index.js --- lib/index.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/index.js b/lib/index.js index 9dcf7c1..c0de819 100644 --- a/lib/index.js +++ b/lib/index.js @@ -13,7 +13,7 @@ var PG = function(clientConstructor) { EventEmitter.call(this); this.Client = clientConstructor; this.Connection = require(__dirname + '/connection'); - this.Query = clientConstructor.Query + this.Query = clientConstructor.Query; this.defaults = defaults; }; @@ -25,8 +25,8 @@ PG.prototype.end = function() { pool.drain(function() { pool.destroyAllNow(); }); - }) -} + }); +}; PG.prototype.connect = function(config, callback) { var self = this; @@ -42,14 +42,14 @@ PG.prototype.connect = function(config, callback) { var poolName = typeof(c) === 'string' ? c : c.user+c.host+c.port+c.database; var pool = pools[poolName]; - if(pool) return pool.acquire(cb); + if(pool) { return pool.acquire(cb); } - var pool = pools[poolName] = genericPool.Pool({ + pool = pools[poolName] = genericPool.Pool({ name: poolName, create: function(callback) { var client = new self.Client(c); client.connect(function(err) { - if(err) return callback(err); + if(err) { return callback(err); } //handle connected client background errors by emitting event //via the pg object and then removing errored client from the pool @@ -74,17 +74,18 @@ PG.prototype.connect = function(config, callback) { log: defaults.poolLog }); return pool.acquire(cb); -} +}; // cancel the query runned by the given client PG.prototype.cancel = function(config, client, query) { var c = config; //allow for no config to be passed - if(typeof c === 'function') + if(typeof c === 'function') { c = defaults; + } var cancellingClient = new this.Client(c); cancellingClient.cancel(client, query); -} +}; module.exports = new PG(Client);