1- /*
2- * decaffeinate suggestions:
3- * DS101: Remove unnecessary use of Array.from
4- * DS102: Remove unnecessary code created because of implicit returns
5- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
6- */
71const parse = function ( trace ) {
82 let data ;
93 let dir = function ( ident ) {
@@ -29,7 +23,7 @@ const parse = function (trace) {
2923 const asciiHexSets = [ ] ;
3024 let lastDir = '' ;
3125
32- for ( const line of Array . from ( traceLines ) ) {
26+ for ( const line of traceLines ) {
3327 const dirMatch = dirPattern . exec ( line ) ;
3428 if ( dirMatch !== null ) {
3529 lastDir = dirMatch [ 0 ] . trim ( ) ;
@@ -45,9 +39,9 @@ const parse = function (trace) {
4539
4640 // split lines by spaces and make array of ASCII hex bytes
4741 const asciiHexBuffer = { request : [ ] , response : [ ] } ;
48- for ( const set of Array . from ( asciiHexSets ) ) {
42+ for ( const set of asciiHexSets ) {
4943 data = set [ 1 ] ;
50- for ( const byte of Array . from ( data . split ( ' ' ) ) ) {
44+ for ( const byte of data . split ( ' ' ) ) {
5145 asciiHexBuffer [ dir ( set [ 0 ] ) ] . push ( byte ) ;
5246 }
5347 }
@@ -56,7 +50,7 @@ const parse = function (trace) {
5650 const asciiIntBuffer = { request : [ ] , response : [ ] } ;
5751 for ( dir in asciiHexBuffer ) {
5852 const hexs = asciiHexBuffer [ dir ] ;
59- for ( const hex of Array . from ( hexs ) ) {
53+ for ( const hex of hexs ) {
6054 asciiIntBuffer [ dir ] . push ( parseInt ( `0x${ hex } ` ) ) ;
6155 }
6256 }
@@ -65,7 +59,7 @@ const parse = function (trace) {
6559 const stringBuffer = { request : [ ] , response : [ ] } ;
6660 for ( dir in asciiIntBuffer ) {
6761 const codes = asciiIntBuffer [ dir ] ;
68- for ( const code of Array . from ( codes ) ) {
62+ for ( const code of codes ) {
6963 stringBuffer [ dir ] . push ( String . fromCharCode ( code ) ) ;
7064 }
7165 }
@@ -83,15 +77,15 @@ const parseToString = function (trace) {
8377
8478 const request = [ ] ;
8579 const requestLines = message . request . split ( '\r\n' ) ;
86- for ( var line of Array . from ( requestLines ) ) {
80+ for ( var line of requestLines ) {
8781 request . push ( `> ${ line } ` ) ;
8882 }
8983 output += request . join ( '\r\n' ) ;
9084 output += '\n' ;
9185 output += '\r\n' ;
9286 const response = [ ] ;
9387 const responseLines = message . response . split ( '\r\n' ) ;
94- for ( line of Array . from ( responseLines ) ) {
88+ for ( line of responseLines ) {
9589 response . push ( `< ${ line } ` ) ;
9690 }
9791 output += response . join ( '\r\n' ) ;
@@ -105,15 +99,15 @@ const parseBackRequestAndResponseFromString = function (string) {
10599
106100 const request = [ ] ;
107101 const stringLines = string . split ( '\r\n' ) ;
108- for ( var line of Array . from ( stringLines ) ) {
102+ for ( var line of stringLines ) {
109103 if ( / ^ > / . test ( line ) ) { request . push ( line . replace ( / ^ > / , '' ) ) ; }
110104 }
111105
112106 // removing trailing LF
113107 output . request = request . join ( '\r\n' ) . replace ( / \n $ / , '' ) ;
114108
115109 const response = [ ] ;
116- for ( line of Array . from ( stringLines ) ) {
110+ for ( line of stringLines ) {
117111 if ( / ^ < / . test ( line ) ) { response . push ( line . replace ( / ^ < / , '' ) ) ; }
118112 }
119113
0 commit comments