Skip to content

Commit 3a326cb

Browse files
committed
lint: fix infix operator spacing
1 parent 5b063b9 commit 3a326cb

File tree

7 files changed

+26
-25
lines changed

7 files changed

+26
-25
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"quotes": [2, "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
3838
"semi": [2, "always"],
3939
"semi-spacing": 2,
40+
"space-infix-ops": 2,
4041
"use-isnan": 2,
4142
"valid-jsdoc": 2,
4243
"valid-typeof": 2

benchmark/analyze.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ function sdev() {
8383
function variance() {
8484
var t = 0, squares = 0, len = numbers.length;
8585

86-
for (var i=0; i<len; i++) {
86+
for (var i = 0; i < len; i++) {
8787
var obs = numbers[i];
8888
t += obs;
8989
squares += Math.pow(obs, 2);
9090
}
91-
return (squares/len) - Math.pow(t/len, 2);
91+
return (squares / len) - Math.pow(t / len, 2);
9292
}
9393

9494
setInterval(report, 1000);

lib/ConnectionConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function ConnectionConfig(options) {
5353
this.maxPacketSize = 0;
5454
this.charsetNumber = (options.charset)
5555
? ConnectionConfig.getCharsetNumber(options.charset)
56-
: options.charsetNumber||Charsets.UTF8_GENERAL_CI;
56+
: options.charsetNumber || Charsets.UTF8_GENERAL_CI;
5757

5858
// Set the client flags
5959
var defaultFlags = ConnectionConfig.getDefaultFlags(options);

lib/protocol/Auth.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Auth.int31Write = function(buffer, number, offset) {
146146

147147
Auth.int32Read = function(buffer, offset){
148148
return (buffer[offset] << 24)
149-
+ (buffer[offset+1] << 16)
150-
+ (buffer[offset+2] << 8)
151-
+ (buffer[offset+3]);
149+
+ (buffer[offset + 1] << 16)
150+
+ (buffer[offset + 2] << 8)
151+
+ (buffer[offset + 3]);
152152
};

lib/protocol/Parser.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -313,31 +313,31 @@ Parser.prototype.parseGeometryValue = function() {
313313
function parseGeometry() {
314314
var result = null;
315315
var byteOrder = buffer.readUInt8(offset); offset += 1;
316-
var wkbType = byteOrder? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
316+
var wkbType = byteOrder ? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
317317
switch(wkbType) {
318318
case 1: // WKBPoint
319-
var x = byteOrder? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
320-
var y = byteOrder? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
319+
var x = byteOrder ? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
320+
var y = byteOrder ? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
321321
result = {x: x, y: y};
322322
break;
323323
case 2: // WKBLineString
324-
var numPoints = byteOrder? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
324+
var numPoints = byteOrder ? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
325325
result = [];
326-
for(var i=numPoints; i>0; i--) {
327-
var x = byteOrder? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
328-
var y = byteOrder? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
326+
for(var i = numPoints; i > 0; i--) {
327+
var x = byteOrder ? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
328+
var y = byteOrder ? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
329329
result.push({x: x, y: y});
330330
}
331331
break;
332332
case 3: // WKBPolygon
333-
var numRings = byteOrder? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
333+
var numRings = byteOrder ? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
334334
result = [];
335-
for(var i=numRings; i>0; i--) {
336-
var numPoints = byteOrder? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
335+
for(var i = numRings; i > 0; i--) {
336+
var numPoints = byteOrder ? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
337337
var line = [];
338-
for(var j=numPoints; j>0; j--) {
339-
var x = byteOrder? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
340-
var y = byteOrder? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
338+
for(var j = numPoints; j > 0; j--) {
339+
var x = byteOrder ? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
340+
var y = byteOrder ? buffer.readDoubleLE(offset) : buffer.readDoubleBE(offset); offset += 8;
341341
line.push({x: x, y: y});
342342
}
343343
result.push(line);
@@ -347,9 +347,9 @@ Parser.prototype.parseGeometryValue = function() {
347347
case 5: // WKBMultiLineString
348348
case 6: // WKBMultiPolygon
349349
case 7: // WKBGeometryCollection
350-
var num = byteOrder? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
350+
var num = byteOrder ? buffer.readUInt32LE(offset) : buffer.readUInt32BE(offset); offset += 4;
351351
var result = [];
352-
for(var i=num; i>0; i--) {
352+
for(var i = num; i > 0; i--) {
353353
result.push(parseGeometry());
354354
}
355355
break;

test/integration/connection/test-timezones.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function testNextDate(connection) {
8888
pad2(dt.getHours()) + ':' + pad2(dt.getMinutes()) + ':' + pad2(dt.getSeconds());
8989
} else {
9090
// If using a specific timezone, it should be a simple offset from the UTC date
91-
var expected_dt = new Date(dt.getTime() + offset * 60*60*1000);
91+
var expected_dt = new Date(dt.getTime() + offset * 60 * 60 * 1000);
9292
expected_date_string = expected_dt.getUTCFullYear() + '-' +
9393
pad2(expected_dt.getUTCMonth() + 1) + '-' +
9494
pad2(expected_dt.getUTCDate()) + ' ' +

test/integration/connection/test-type-cast-query.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ common.getTestConnection({typeCast: true}, function (err, connection) {
1414

1515
var point = rows[0].point;
1616
var byteOrder = point.readUInt8(4);
17-
var wkbType = byteOrder? point.readUInt32LE(5) : point.readUInt32BE(5);
18-
var x = byteOrder? point.readDoubleLE(9) : point.readDoubleBE(9);
19-
var y = byteOrder? point.readDoubleLE(17) : point.readDoubleBE(17);
17+
var wkbType = byteOrder ? point.readUInt32LE(5) : point.readUInt32BE(5);
18+
var x = byteOrder ? point.readDoubleLE(9) : point.readDoubleBE(9);
19+
var y = byteOrder ? point.readDoubleLE(17) : point.readDoubleBE(17);
2020

2121
assert.strictEqual(typeof rows[0].date, 'object');
2222
assert.equal(Buffer.isBuffer(rows[0].date), true);

0 commit comments

Comments
 (0)