@@ -50,12 +50,12 @@ var err = { type: 'error', data: 'parser error' };
50
50
*/
51
51
52
52
exports . encodePacket = function ( packet , supportsBinary , utf8encode , callback ) {
53
- if ( 'function' == typeof supportsBinary ) {
53
+ if ( typeof supportsBinary === 'function' ) {
54
54
callback = supportsBinary ;
55
55
supportsBinary = null ;
56
56
}
57
57
58
- if ( 'function' == typeof utf8encode ) {
58
+ if ( typeof utf8encode === 'function' ) {
59
59
callback = utf8encode ;
60
60
utf8encode = null ;
61
61
}
@@ -122,8 +122,8 @@ exports.decodePacket = function (data, binaryType, utf8decode) {
122
122
return err ;
123
123
}
124
124
// String data
125
- if ( typeof data == 'string' ) {
126
- if ( data . charAt ( 0 ) == 'b' ) {
125
+ if ( typeof data === 'string' ) {
126
+ if ( data . charAt ( 0 ) === 'b' ) {
127
127
return exports . decodeBase64Packet ( data . substr ( 1 ) , binaryType ) ;
128
128
}
129
129
@@ -208,7 +208,7 @@ exports.decodeBase64Packet = function(msg, binaryType) {
208
208
*/
209
209
210
210
exports . encodePayload = function ( packets , supportsBinary , callback ) {
211
- if ( typeof supportsBinary == 'function' ) {
211
+ if ( typeof supportsBinary === 'function' ) {
212
212
callback = supportsBinary ;
213
213
supportsBinary = null ;
214
214
}
@@ -265,7 +265,7 @@ function map(ary, each, done) {
265
265
*/
266
266
267
267
exports . decodePayload = function ( data , binaryType , callback ) {
268
- if ( 'string' != typeof data ) {
268
+ if ( typeof data !== 'string' ) {
269
269
return exports . decodePayloadAsBinary ( data , binaryType , callback ) ;
270
270
}
271
271
@@ -275,7 +275,7 @@ exports.decodePayload = function (data, binaryType, callback) {
275
275
}
276
276
277
277
var packet ;
278
- if ( data == '' ) {
278
+ if ( data === '' ) {
279
279
// parser error - ignoring payload
280
280
return callback ( err , 0 , 1 ) ;
281
281
}
@@ -285,12 +285,12 @@ exports.decodePayload = function (data, binaryType, callback) {
285
285
for ( var i = 0 , l = data . length ; i < l ; i ++ ) {
286
286
var chr = data . charAt ( i ) ;
287
287
288
- if ( ':' != chr ) {
288
+ if ( chr !== ':' ) {
289
289
length += chr ;
290
290
continue ;
291
291
}
292
292
293
- if ( '' == length || ( length != ( n = Number ( length ) ) ) ) {
293
+ if ( length === '' || ( length != ( n = Number ( length ) ) ) ) {
294
294
// parser error - ignoring payload
295
295
return callback ( err , 0 , 1 ) ;
296
296
}
@@ -305,7 +305,7 @@ exports.decodePayload = function (data, binaryType, callback) {
305
305
if ( msg . length ) {
306
306
packet = exports . decodePacket ( msg , binaryType , false ) ;
307
307
308
- if ( err . type == packet . type && err . data == packet . data ) {
308
+ if ( err . type === packet . type && err . data = == packet . data ) {
309
309
// parser error in individual packet - ignoring payload
310
310
return callback ( err , 0 , 1 ) ;
311
311
}
@@ -319,7 +319,7 @@ exports.decodePayload = function (data, binaryType, callback) {
319
319
length = '' ;
320
320
}
321
321
322
- if ( length != '' ) {
322
+ if ( length !== '' ) {
323
323
// parser error - ignoring payload
324
324
return callback ( err , 0 , 1 ) ;
325
325
}
@@ -447,7 +447,7 @@ exports.decodePayloadAsBinary = function (data, binaryType, callback) {
447
447
var strLen = '' ;
448
448
var isString = bufferTail [ 0 ] === 0 ;
449
449
for ( var i = 1 ; ; i ++ ) {
450
- if ( bufferTail [ i ] == 255 ) break ;
450
+ if ( bufferTail [ i ] === 255 ) break ;
451
451
// 310 = char length of Number.MAX_VALUE
452
452
if ( strLen . length > 310 ) {
453
453
return callback ( err , 0 , 1 ) ;
0 commit comments