@@ -126,7 +126,7 @@ function Encoder() {}
126
126
Encoder . prototype . encode = function ( obj , callback ) {
127
127
debug ( 'encoding packet %j' , obj ) ;
128
128
129
- if ( exports . BINARY_EVENT == obj . type || exports . BINARY_ACK == obj . type ) {
129
+ if ( exports . BINARY_EVENT === obj . type || exports . BINARY_ACK = == obj . type ) {
130
130
encodeAsBinary ( obj , callback ) ;
131
131
}
132
132
else {
@@ -151,14 +151,14 @@ function encodeAsString(obj) {
151
151
str += obj . type ;
152
152
153
153
// attachments if we have them
154
- if ( exports . BINARY_EVENT == obj . type || exports . BINARY_ACK == obj . type ) {
154
+ if ( exports . BINARY_EVENT === obj . type || exports . BINARY_ACK = == obj . type ) {
155
155
str += obj . attachments ;
156
156
str += '-' ;
157
157
}
158
158
159
159
// if we have a namespace other than `/`
160
160
// we append it followed by a comma `,`
161
- if ( obj . nsp && '/' != obj . nsp ) {
161
+ if ( obj . nsp && '/' !== obj . nsp ) {
162
162
nsp = true ;
163
163
str += obj . nsp ;
164
164
}
@@ -233,9 +233,9 @@ Emitter(Decoder.prototype);
233
233
234
234
Decoder . prototype . add = function ( obj ) {
235
235
var packet ;
236
- if ( 'string' == typeof obj ) {
236
+ if ( typeof obj === 'string' ) {
237
237
packet = decodeString ( obj ) ;
238
- if ( exports . BINARY_EVENT == packet . type || exports . BINARY_ACK == packet . type ) { // binary packet's json
238
+ if ( exports . BINARY_EVENT === packet . type || exports . BINARY_ACK = == packet . type ) { // binary packet's json
239
239
this . reconstructor = new BinaryReconstructor ( packet ) ;
240
240
241
241
// no attachments, labeled binary but no binary data to follow
@@ -281,24 +281,24 @@ function decodeString(str) {
281
281
// look up attachments if type binary
282
282
if ( exports . BINARY_EVENT == p . type || exports . BINARY_ACK == p . type ) {
283
283
var buf = '' ;
284
- while ( str . charAt ( ++ i ) != '-' ) {
284
+ while ( str . charAt ( ++ i ) !== '-' ) {
285
285
buf += str . charAt ( i ) ;
286
286
if ( i == str . length ) break ;
287
287
}
288
- if ( buf != Number ( buf ) || str . charAt ( i ) != '-' ) {
288
+ if ( buf != Number ( buf ) || str . charAt ( i ) !== '-' ) {
289
289
throw new Error ( 'Illegal attachments' ) ;
290
290
}
291
291
p . attachments = Number ( buf ) ;
292
292
}
293
293
294
294
// look up namespace (if any)
295
- if ( '/' == str . charAt ( i + 1 ) ) {
295
+ if ( '/' === str . charAt ( i + 1 ) ) {
296
296
p . nsp = '' ;
297
297
while ( ++ i ) {
298
298
var c = str . charAt ( i ) ;
299
- if ( ',' == c ) break ;
299
+ if ( ',' === c ) break ;
300
300
p . nsp += c ;
301
- if ( i == str . length ) break ;
301
+ if ( i === str . length ) break ;
302
302
}
303
303
} else {
304
304
p . nsp = '/' ;
@@ -315,7 +315,7 @@ function decodeString(str) {
315
315
break ;
316
316
}
317
317
p . id += str . charAt ( i ) ;
318
- if ( i == str . length ) break ;
318
+ if ( i === str . length ) break ;
319
319
}
320
320
p . id = Number ( p . id ) ;
321
321
}
@@ -336,7 +336,7 @@ function tryParse(p, str) {
336
336
return error ( ) ;
337
337
}
338
338
return p ;
339
- } ;
339
+ }
340
340
341
341
/**
342
342
* Deallocates a parser's resources
@@ -377,7 +377,7 @@ function BinaryReconstructor(packet) {
377
377
378
378
BinaryReconstructor . prototype . takeBinaryData = function ( binData ) {
379
379
this . buffers . push ( binData ) ;
380
- if ( this . buffers . length == this . reconPack . attachments ) { // done with buffer list
380
+ if ( this . buffers . length === this . reconPack . attachments ) { // done with buffer list
381
381
var packet = binary . reconstructPacket ( this . reconPack , this . buffers ) ;
382
382
this . finishedReconstruction ( ) ;
383
383
return packet ;
0 commit comments