@@ -33,8 +33,8 @@ const normalize_columns_array = function (columns) {
3333 const column = columns [ i ] ;
3434 if ( column === undefined || column === null || column === false ) {
3535 normalizedColumns [ i ] = { disabled : true } ;
36- } else if ( typeof column === "string" ) {
37- normalizedColumns [ i ] = { name : column } ;
36+ } else if ( typeof column === "string" || typeof column === "number" ) {
37+ normalizedColumns [ i ] = { name : ` ${ column } ` } ;
3838 } else if ( is_object ( column ) ) {
3939 if ( typeof column . name !== "string" ) {
4040 throw new CsvError ( "CSV_OPTION_COLUMNS_MISSING_NAME" , [
@@ -876,6 +876,7 @@ const boms = {
876876const transform = function ( original_options = { } ) {
877877 const info = {
878878 bytes : 0 ,
879+ bytes_records : 0 ,
879880 comment_lines : 0 ,
880881 empty_lines : 0 ,
881882 invalid_field_length : 0 ,
@@ -1153,7 +1154,7 @@ const transform = function (original_options = {}) {
11531154 this . info . comment_lines ++ ;
11541155 // Skip full comment line
11551156 } else {
1156- // Activate records emition if above from_line
1157+ // Activate records emission if above from_line
11571158 if (
11581159 this . state . enabled === false &&
11591160 this . info . lines +
@@ -1551,6 +1552,7 @@ const transform = function (original_options = {}) {
15511552 return ;
15521553 }
15531554 }
1555+ this . info . bytes_records += this . info . bytes ;
15541556 push ( record ) ;
15551557 } ,
15561558 // Return a tuple with the error and the casted value
@@ -1738,6 +1740,7 @@ const transform = function (original_options = {}) {
17381740 const { columns, raw, encoding } = this . options ;
17391741 return {
17401742 ...this . __infoDataSet ( ) ,
1743+ bytes_records : this . info . bytes ,
17411744 error : this . state . error ,
17421745 header : columns === true ,
17431746 index : this . state . record . length ,
@@ -1747,8 +1750,11 @@ const transform = function (original_options = {}) {
17471750 __infoField : function ( ) {
17481751 const { columns } = this . options ;
17491752 const isColumns = Array . isArray ( columns ) ;
1753+ // Bytes records are only incremented when all records'fields are parsed
1754+ const bytes_records = this . info . bytes_records ;
17501755 return {
17511756 ...this . __infoRecord ( ) ,
1757+ bytes_records : bytes_records ,
17521758 column :
17531759 isColumns === true
17541760 ? columns . length > this . state . record . length
@@ -1882,7 +1888,7 @@ const parse = function () {
18821888 parser . write ( data ) ;
18831889 parser . end ( ) ;
18841890 } ;
1885- // Support Deno, Rollup doesnt provide a shim for setImmediate
1891+ // Support Deno, Rollup doesn't provide a shim for setImmediate
18861892 if ( typeof setImmediate === "function" ) {
18871893 setImmediate ( writer ) ;
18881894 } else {
0 commit comments