@@ -5192,18 +5192,18 @@ var csv_parse_sync = (function (exports) {
5192
5192
`got ${ JSON . stringify ( options . columns ) } `
5193
5193
] , options ) ;
5194
5194
}
5195
- // Normalize option `columns_duplicates_to_array `
5196
- if ( options . columns_duplicates_to_array === undefined || options . columns_duplicates_to_array === null || options . columns_duplicates_to_array === false ) {
5197
- options . columns_duplicates_to_array = false ;
5198
- } else if ( options . columns_duplicates_to_array !== true ) {
5199
- throw new CsvError ( 'CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY ' , [
5200
- 'Invalid option columns_duplicates_to_array :' ,
5195
+ // Normalize option `group_columns_by_name `
5196
+ if ( options . group_columns_by_name === undefined || options . group_columns_by_name === null || options . group_columns_by_name === false ) {
5197
+ options . group_columns_by_name = false ;
5198
+ } else if ( options . group_columns_by_name !== true ) {
5199
+ throw new CsvError ( 'CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME ' , [
5200
+ 'Invalid option group_columns_by_name :' ,
5201
5201
'expect an boolean,' ,
5202
- `got ${ JSON . stringify ( options . columns_duplicates_to_array ) } `
5202
+ `got ${ JSON . stringify ( options . group_columns_by_name ) } `
5203
5203
] , options ) ;
5204
5204
} else if ( options . columns === false ) {
5205
- throw new CsvError ( 'CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY ' , [
5206
- 'Invalid option columns_duplicates_to_array :' ,
5205
+ throw new CsvError ( 'CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME ' , [
5206
+ 'Invalid option group_columns_by_name :' ,
5207
5207
'the `columns` mode must be activated.'
5208
5208
] , options ) ;
5209
5209
}
@@ -5859,7 +5859,7 @@ var csv_parse_sync = (function (exports) {
5859
5859
}
5860
5860
}
5861
5861
__onRecord ( ) {
5862
- const { columns, columns_duplicates_to_array , encoding, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_records_with_empty_values} = this . options ;
5862
+ const { columns, group_columns_by_name , encoding, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_records_with_empty_values} = this . options ;
5863
5863
const { enabled, record} = this . state ;
5864
5864
if ( enabled === false ) {
5865
5865
return this . __resetRecord ( ) ;
@@ -5923,7 +5923,7 @@ var csv_parse_sync = (function (exports) {
5923
5923
for ( let i = 0 , l = record . length ; i < l ; i ++ ) {
5924
5924
if ( columns [ i ] === undefined || columns [ i ] . disabled ) continue ;
5925
5925
// Turn duplicate columns into an array
5926
- if ( columns_duplicates_to_array === true && obj [ columns [ i ] . name ] !== undefined ) {
5926
+ if ( group_columns_by_name === true && obj [ columns [ i ] . name ] !== undefined ) {
5927
5927
if ( Array . isArray ( obj [ columns [ i ] . name ] ) ) {
5928
5928
obj [ columns [ i ] . name ] = obj [ columns [ i ] . name ] . concat ( record [ i ] ) ;
5929
5929
} else {
0 commit comments