File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -286,11 +286,9 @@ function decodeString(str) {
286
286
287
287
// look up attachments if type binary
288
288
if ( exports . BINARY_EVENT === p . type || exports . BINARY_ACK === p . type ) {
289
- var buf = '' ;
290
- while ( str . charAt ( ++ i ) !== '-' ) {
291
- buf += str . charAt ( i ) ;
292
- if ( i == str . length ) break ;
293
- }
289
+ var start = i + 1 ;
290
+ while ( str . charAt ( ++ i ) !== '-' && i != str . length ) { }
291
+ var buf = str . substring ( start , i ) ;
294
292
if ( buf != Number ( buf ) || str . charAt ( i ) !== '-' ) {
295
293
throw new Error ( 'Illegal attachments' ) ;
296
294
}
@@ -299,13 +297,13 @@ function decodeString(str) {
299
297
300
298
// look up namespace (if any)
301
299
if ( '/' === str . charAt ( i + 1 ) ) {
302
- p . nsp = '' ;
300
+ var start = i + 1 ;
303
301
while ( ++ i ) {
304
302
var c = str . charAt ( i ) ;
305
303
if ( ',' === c ) break ;
306
- p . nsp += c ;
307
304
if ( i === str . length ) break ;
308
305
}
306
+ p . nsp = str . substring ( start , i ) ;
309
307
} else {
310
308
p . nsp = '/' ;
311
309
}
You can’t perform that action at this time.
0 commit comments