@@ -126,7 +126,7 @@ function Encoder() {}
126126Encoder . prototype . encode = function ( obj , callback ) {
127127 debug ( 'encoding packet %j' , obj ) ;
128128
129- if ( exports . BINARY_EVENT == obj . type || exports . BINARY_ACK == obj . type ) {
129+ if ( exports . BINARY_EVENT === obj . type || exports . BINARY_ACK = == obj . type ) {
130130 encodeAsBinary ( obj , callback ) ;
131131 }
132132 else {
@@ -151,14 +151,14 @@ function encodeAsString(obj) {
151151 str += obj . type ;
152152
153153 // 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 ) {
155155 str += obj . attachments ;
156156 str += '-' ;
157157 }
158158
159159 // if we have a namespace other than `/`
160160 // we append it followed by a comma `,`
161- if ( obj . nsp && '/' != obj . nsp ) {
161+ if ( obj . nsp && '/' !== obj . nsp ) {
162162 nsp = true ;
163163 str += obj . nsp ;
164164 }
@@ -233,9 +233,9 @@ Emitter(Decoder.prototype);
233233
234234Decoder . prototype . add = function ( obj ) {
235235 var packet ;
236- if ( 'string' == typeof obj ) {
236+ if ( typeof obj === 'string' ) {
237237 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
239239 this . reconstructor = new BinaryReconstructor ( packet ) ;
240240
241241 // no attachments, labeled binary but no binary data to follow
@@ -281,24 +281,24 @@ function decodeString(str) {
281281 // look up attachments if type binary
282282 if ( exports . BINARY_EVENT == p . type || exports . BINARY_ACK == p . type ) {
283283 var buf = '' ;
284- while ( str . charAt ( ++ i ) != '-' ) {
284+ while ( str . charAt ( ++ i ) !== '-' ) {
285285 buf += str . charAt ( i ) ;
286286 if ( i == str . length ) break ;
287287 }
288- if ( buf != Number ( buf ) || str . charAt ( i ) != '-' ) {
288+ if ( buf != Number ( buf ) || str . charAt ( i ) !== '-' ) {
289289 throw new Error ( 'Illegal attachments' ) ;
290290 }
291291 p . attachments = Number ( buf ) ;
292292 }
293293
294294 // look up namespace (if any)
295- if ( '/' == str . charAt ( i + 1 ) ) {
295+ if ( '/' === str . charAt ( i + 1 ) ) {
296296 p . nsp = '' ;
297297 while ( ++ i ) {
298298 var c = str . charAt ( i ) ;
299- if ( ',' == c ) break ;
299+ if ( ',' === c ) break ;
300300 p . nsp += c ;
301- if ( i == str . length ) break ;
301+ if ( i === str . length ) break ;
302302 }
303303 } else {
304304 p . nsp = '/' ;
@@ -315,7 +315,7 @@ function decodeString(str) {
315315 break ;
316316 }
317317 p . id += str . charAt ( i ) ;
318- if ( i == str . length ) break ;
318+ if ( i === str . length ) break ;
319319 }
320320 p . id = Number ( p . id ) ;
321321 }
@@ -336,7 +336,7 @@ function tryParse(p, str) {
336336 return error ( ) ;
337337 }
338338 return p ;
339- } ;
339+ }
340340
341341/**
342342 * Deallocates a parser's resources
@@ -377,7 +377,7 @@ function BinaryReconstructor(packet) {
377377
378378BinaryReconstructor . prototype . takeBinaryData = function ( binData ) {
379379 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
381381 var packet = binary . reconstructPacket ( this . reconPack , this . buffers ) ;
382382 this . finishedReconstruction ( ) ;
383383 return packet ;
0 commit comments