jshint fixes
This commit is contained in:
parent
9dd887dc4d
commit
6e0acbda50
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
function ArrayBufferSer(type, data, options) {
|
function ArrayBufferSer(type, data, options) {
|
||||||
if(type === undefined) throw "ArrayBufferSer should be created with a type";
|
if(type === undefined) {
|
||||||
|
throw "ArrayBufferSer should be created with a type";
|
||||||
|
}
|
||||||
this.options = options || {};
|
this.options = options || {};
|
||||||
this._initFunctions();
|
this._initFunctions();
|
||||||
this.headerSize = 8;
|
this.headerSize = 8;
|
||||||
@ -14,13 +16,14 @@ function ArrayBufferSer(type, data, options) {
|
|||||||
|
|
||||||
var w = this.writeFn[type];
|
var w = this.writeFn[type];
|
||||||
|
|
||||||
|
var i;
|
||||||
if(!this.options.delta) {
|
if(!this.options.delta) {
|
||||||
for(var i = 0; i < data.length; ++i) {
|
for(i = 0; i < data.length; ++i) {
|
||||||
this[w](data[i]);
|
this[w](data[i]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this[w](data[0]);
|
this[w](data[0]);
|
||||||
for(var i = 1; i < data.length; ++i) {
|
for(i = 1; i < data.length; ++i) {
|
||||||
this[w](data[i] - data[i - 1]);
|
this[w](data[i] - data[i - 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,7 +69,7 @@ ArrayBufferSer.prototype = {
|
|||||||
var s = this.sizes[type];
|
var s = this.sizes[type];
|
||||||
if(s) {
|
if(s) {
|
||||||
var r = off % s;
|
var r = off % s;
|
||||||
return r == 0 ? 0 : s - r;
|
return r === 0 ? 0 : s - r;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
@ -78,7 +81,7 @@ ArrayBufferSer.prototype = {
|
|||||||
return s*t.length;
|
return s*t.length;
|
||||||
}
|
}
|
||||||
s = 0;
|
s = 0;
|
||||||
if(this.type == ArrayBufferSer.STRING) {
|
if(this.type === ArrayBufferSer.STRING) {
|
||||||
// calculate size with padding
|
// calculate size with padding
|
||||||
t.forEach(function(arr) {
|
t.forEach(function(arr) {
|
||||||
var pad = self._paddingFor(offset, ArrayBufferSer.MAX_PADDING);
|
var pad = self._paddingFor(offset, ArrayBufferSer.MAX_PADDING);
|
||||||
@ -108,16 +111,30 @@ ArrayBufferSer.prototype = {
|
|||||||
return this.headerSize + this._sizeFor(this.headerSize, this.data);
|
return this.headerSize + this._sizeFor(this.headerSize, this.data);
|
||||||
},
|
},
|
||||||
|
|
||||||
writeFn: ['', 'writeInt8', 'writeUInt8','writeUInt8Clamp', 'writeInt16LE', 'writeUInt16LE', 'writeUInt32LE', 'writeUInt32LE', 'writeFloatLE', 'writeDoubleLE', 'writeString', 'writteBuffer'],
|
writeFn: [
|
||||||
|
'',
|
||||||
|
'writeInt8',
|
||||||
|
'writeUInt8',
|
||||||
|
'writeUInt8Clamp',
|
||||||
|
'writeInt16LE',
|
||||||
|
'writeUInt16LE',
|
||||||
|
'writeUInt32LE',
|
||||||
|
'writeUInt32LE',
|
||||||
|
'writeFloatLE',
|
||||||
|
'writeDoubleLE',
|
||||||
|
'writeString',
|
||||||
|
'writteBuffer'
|
||||||
|
],
|
||||||
|
|
||||||
_initFunctions: function() {
|
_initFunctions: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.writeFn.forEach(function(fn) {
|
this.writeFn.forEach(function(fn) {
|
||||||
if(self[fn] === undefined)
|
if(self[fn] === undefined) {
|
||||||
self[fn] = function(d) {
|
self[fn] = function(d) {
|
||||||
self.buffer[fn](d, self.offset);
|
self.buffer[fn](d, self.offset);
|
||||||
self.offset += self.sizes[self.type];
|
self.offset += self.sizes[self.type];
|
||||||
}
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -30,7 +30,9 @@ function userByHostName(host) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mat.length !== 2) {
|
if (mat.length !== 2) {
|
||||||
console.error("ERROR: pattern '" + re_userFromHost + "' gave unexpected matches against '" + host + "': " + mat);
|
console.error(
|
||||||
|
"ERROR: pattern '" + re_userFromHost + "' gave unexpected matches against '" + host + "': " + mat
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return mat[1];
|
return mat[1];
|
||||||
|
@ -34,7 +34,9 @@ For logger.trace('one','two','three'):
|
|||||||
//
|
//
|
||||||
// We only log error and higher errors
|
// We only log error and higher errors
|
||||||
//
|
//
|
||||||
if ( loggingEvent.level.level < 40000 ) return;
|
if ( loggingEvent.level.level < 40000 ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rollbar.reportMessage(loggingEvent.data);
|
rollbar.reportMessage(loggingEvent.data);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user