File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -286,11 +286,9 @@ function decodeString(str) {
286286
287287 // look up attachments if type binary
288288 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 ) ;
294292 if ( buf != Number ( buf ) || str . charAt ( i ) !== '-' ) {
295293 throw new Error ( 'Illegal attachments' ) ;
296294 }
@@ -299,13 +297,13 @@ function decodeString(str) {
299297
300298 // look up namespace (if any)
301299 if ( '/' === str . charAt ( i + 1 ) ) {
302- p . nsp = '' ;
300+ var start = i + 1 ;
303301 while ( ++ i ) {
304302 var c = str . charAt ( i ) ;
305303 if ( ',' === c ) break ;
306- p . nsp += c ;
307304 if ( i === str . length ) break ;
308305 }
306+ p . nsp = str . substring ( start , i ) ;
309307 } else {
310308 p . nsp = '/' ;
311309 }
You can’t perform that action at this time.
0 commit comments