From 60a022b0b08823fd894caad80fcf0ab11e876701 Mon Sep 17 00:00:00 2001 From: Philipp Borgers Date: Mon, 21 Jan 2013 14:16:41 +0100 Subject: [PATCH] fix jshint errors for lib/native/index.js --- lib/native/index.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/native/index.js b/lib/native/index.js index c0394b45..599ad25b 100644 --- a/lib/native/index.js +++ b/lib/native/index.js @@ -40,18 +40,18 @@ p.connect = function(cb) { //remove single-fire connection error callback self.removeListener('error', errCallback); cb(null); - } + }; errCallback = function(err) { //remove singel-fire connection success callback self.removeListener('connect', connectCallback); cb(err); - } + }; self.once('connect', connectCallback); self.once('error', errCallback); } nativeConnect.call(self, conString); - }) -} + }); +}; p._copy = function (text, stream) { var q = new NativeQuery(text, function (error) { if (error) { @@ -64,7 +64,7 @@ p._copy = function (text, stream) { this._queryQueue.push(q); this._pulseQueryQueue(); return q.stream; -} +}; p.copyFrom = function (text) { return this._copy(text, new CopyFromStream()); }; @@ -82,7 +82,7 @@ p.query = function(config, values, callback) { this._queryQueue.push(query); this._pulseQueryQueue(); return query; -} +}; var nativeCancel = p.cancel; @@ -103,7 +103,11 @@ p._pulseQueryQueue = function(initialConnection) { var query = this._queryQueue.shift(); if(!query) { if(!initialConnection) { - this._drainPaused ? this._drainPaused++ : this.emit('drain'); + if(this._drainPaused) { + this._drainPaused++; + } else { + this.emit('drain'); + } } return; } @@ -119,12 +123,12 @@ p._pulseQueryQueue = function(initialConnection) { } else if(query.values) { //call native function - this._sendQueryWithParams(query.text, query.values) + this._sendQueryWithParams(query.text, query.values); } else { //call native function this._sendQuery(query.text); } -} +}; p.pauseDrain = function() { this._drainPaused = 1; @@ -132,8 +136,8 @@ p.pauseDrain = function() { p.resumeDrain = function() { if(this._drainPaused > 1) { - this.emit('drain') - }; + this.emit('drain'); + } this._drainPaused = 0; }; p.sendCopyFail = function(msg) {