Skip to content

Commit aa432c1

Browse files
committed
refactor(csv-parse)!: rename skip_records_with_empty_values
1 parent 9fffd50 commit aa432c1

17 files changed

Lines changed: 89 additions & 90 deletions

packages/csv-parse/ROADMAP.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Below is the list of upgrades we are considering for the next major release. The
44

55
We invite you to join and contribute but create an issue before engaging any work. Some tasks are scheduled for another time or might depends on another one.
66

7-
* `skip_lines_with_empty_values`: rename to skip_records_with_empty_values (easy)
87
* `skip_lines_with_error`: rename to skip_records_with_error (easy)
98
* `max_comment_size`: new option (medium)
109
* promise: new API module (medium)

packages/csv-parse/dist/cjs/index.cjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5453,11 +5453,11 @@ class Parser extends Transform {
54535453
}else {
54545454
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
54555455
}
5456-
// Normalize option `skip_lines_with_empty_values`
5457-
if(typeof options.skip_lines_with_empty_values === 'boolean');else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){
5458-
options.skip_lines_with_empty_values = false;
5456+
// Normalize option `skip_records_with_empty_values`
5457+
if(typeof options.skip_records_with_empty_values === 'boolean');else if(options.skip_records_with_empty_values === undefined || options.skip_records_with_empty_values === null){
5458+
options.skip_records_with_empty_values = false;
54595459
}else {
5460-
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
5460+
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54615461
}
54625462
// Normalize option `skip_lines_with_error`
54635463
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
@@ -5860,15 +5860,15 @@ class Parser extends Transform {
58605860
}
58615861
}
58625862
__onRecord(){
5863-
const {columns, columns_duplicates_to_array, encoding, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_lines_with_empty_values} = this.options;
5863+
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;
58645864
const {enabled, record} = this.state;
58655865
if(enabled === false){
58665866
return this.__resetRecord();
58675867
}
58685868
// Convert the first line into column names
58695869
const recordLength = record.length;
58705870
if(columns === true){
5871-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5871+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
58725872
this.__resetRecord();
58735873
return;
58745874
}
@@ -5909,7 +5909,7 @@ class Parser extends Transform {
59095909
if(finalErr) return finalErr;
59105910
}
59115911
}
5912-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5912+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
59135913
this.__resetRecord();
59145914
return;
59155915
}

packages/csv-parse/dist/cjs/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ export interface Options {
191191
/**
192192
* Don't generate records for lines containing empty column values (column matching /\s*\/), defaults to false.
193193
*/
194-
skip_lines_with_empty_values?: boolean;
195-
skipLinesWithEmptyValues?: boolean;
194+
skip_records_with_empty_values?: boolean;
195+
skipRecordsWithEmptyValues?: boolean;
196196
/**
197197
* Stop handling records after the requested number of records.
198198
*/

packages/csv-parse/dist/cjs/sync.cjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5453,11 +5453,11 @@ class Parser extends Transform {
54535453
}else {
54545454
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
54555455
}
5456-
// Normalize option `skip_lines_with_empty_values`
5457-
if(typeof options.skip_lines_with_empty_values === 'boolean');else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){
5458-
options.skip_lines_with_empty_values = false;
5456+
// Normalize option `skip_records_with_empty_values`
5457+
if(typeof options.skip_records_with_empty_values === 'boolean');else if(options.skip_records_with_empty_values === undefined || options.skip_records_with_empty_values === null){
5458+
options.skip_records_with_empty_values = false;
54595459
}else {
5460-
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
5460+
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54615461
}
54625462
// Normalize option `skip_lines_with_error`
54635463
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
@@ -5860,15 +5860,15 @@ class Parser extends Transform {
58605860
}
58615861
}
58625862
__onRecord(){
5863-
const {columns, columns_duplicates_to_array, encoding, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_lines_with_empty_values} = this.options;
5863+
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;
58645864
const {enabled, record} = this.state;
58655865
if(enabled === false){
58665866
return this.__resetRecord();
58675867
}
58685868
// Convert the first line into column names
58695869
const recordLength = record.length;
58705870
if(columns === true){
5871-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5871+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
58725872
this.__resetRecord();
58735873
return;
58745874
}
@@ -5909,7 +5909,7 @@ class Parser extends Transform {
59095909
if(finalErr) return finalErr;
59105910
}
59115911
}
5912-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5912+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
59135913
this.__resetRecord();
59145914
return;
59155915
}

packages/csv-parse/dist/esm/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ export interface Options {
191191
/**
192192
* Don't generate records for lines containing empty column values (column matching /\s*\/), defaults to false.
193193
*/
194-
skip_lines_with_empty_values?: boolean;
195-
skipLinesWithEmptyValues?: boolean;
194+
skip_records_with_empty_values?: boolean;
195+
skipRecordsWithEmptyValues?: boolean;
196196
/**
197197
* Stop handling records after the requested number of records.
198198
*/

packages/csv-parse/dist/esm/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5449,11 +5449,11 @@ class Parser extends Transform {
54495449
}else {
54505450
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
54515451
}
5452-
// Normalize option `skip_lines_with_empty_values`
5453-
if(typeof options.skip_lines_with_empty_values === 'boolean');else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){
5454-
options.skip_lines_with_empty_values = false;
5452+
// Normalize option `skip_records_with_empty_values`
5453+
if(typeof options.skip_records_with_empty_values === 'boolean');else if(options.skip_records_with_empty_values === undefined || options.skip_records_with_empty_values === null){
5454+
options.skip_records_with_empty_values = false;
54555455
}else {
5456-
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
5456+
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54575457
}
54585458
// Normalize option `skip_lines_with_error`
54595459
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
@@ -5856,15 +5856,15 @@ class Parser extends Transform {
58565856
}
58575857
}
58585858
__onRecord(){
5859-
const {columns, columns_duplicates_to_array, encoding, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_lines_with_empty_values} = this.options;
5859+
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;
58605860
const {enabled, record} = this.state;
58615861
if(enabled === false){
58625862
return this.__resetRecord();
58635863
}
58645864
// Convert the first line into column names
58655865
const recordLength = record.length;
58665866
if(columns === true){
5867-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5867+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
58685868
this.__resetRecord();
58695869
return;
58705870
}
@@ -5905,7 +5905,7 @@ class Parser extends Transform {
59055905
if(finalErr) return finalErr;
59065906
}
59075907
}
5908-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5908+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
59095909
this.__resetRecord();
59105910
return;
59115911
}

packages/csv-parse/dist/esm/sync.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5449,11 +5449,11 @@ class Parser extends Transform {
54495449
}else {
54505450
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
54515451
}
5452-
// Normalize option `skip_lines_with_empty_values`
5453-
if(typeof options.skip_lines_with_empty_values === 'boolean');else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){
5454-
options.skip_lines_with_empty_values = false;
5452+
// Normalize option `skip_records_with_empty_values`
5453+
if(typeof options.skip_records_with_empty_values === 'boolean');else if(options.skip_records_with_empty_values === undefined || options.skip_records_with_empty_values === null){
5454+
options.skip_records_with_empty_values = false;
54555455
}else {
5456-
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
5456+
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54575457
}
54585458
// Normalize option `skip_lines_with_error`
54595459
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
@@ -5856,15 +5856,15 @@ class Parser extends Transform {
58565856
}
58575857
}
58585858
__onRecord(){
5859-
const {columns, columns_duplicates_to_array, encoding, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_lines_with_empty_values} = this.options;
5859+
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;
58605860
const {enabled, record} = this.state;
58615861
if(enabled === false){
58625862
return this.__resetRecord();
58635863
}
58645864
// Convert the first line into column names
58655865
const recordLength = record.length;
58665866
if(columns === true){
5867-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5867+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
58685868
this.__resetRecord();
58695869
return;
58705870
}
@@ -5905,7 +5905,7 @@ class Parser extends Transform {
59055905
if(finalErr) return finalErr;
59065906
}
59075907
}
5908-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5908+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
59095909
this.__resetRecord();
59105910
return;
59115911
}

packages/csv-parse/dist/iife/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5452,11 +5452,11 @@ var csv_parse = (function (exports) {
54525452
}else {
54535453
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
54545454
}
5455-
// Normalize option `skip_lines_with_empty_values`
5456-
if(typeof options.skip_lines_with_empty_values === 'boolean');else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){
5457-
options.skip_lines_with_empty_values = false;
5455+
// Normalize option `skip_records_with_empty_values`
5456+
if(typeof options.skip_records_with_empty_values === 'boolean');else if(options.skip_records_with_empty_values === undefined || options.skip_records_with_empty_values === null){
5457+
options.skip_records_with_empty_values = false;
54585458
}else {
5459-
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
5459+
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54605460
}
54615461
// Normalize option `skip_lines_with_error`
54625462
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
@@ -5859,15 +5859,15 @@ var csv_parse = (function (exports) {
58595859
}
58605860
}
58615861
__onRecord(){
5862-
const {columns, columns_duplicates_to_array, encoding, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_lines_with_empty_values} = this.options;
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;
58635863
const {enabled, record} = this.state;
58645864
if(enabled === false){
58655865
return this.__resetRecord();
58665866
}
58675867
// Convert the first line into column names
58685868
const recordLength = record.length;
58695869
if(columns === true){
5870-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5870+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
58715871
this.__resetRecord();
58725872
return;
58735873
}
@@ -5908,7 +5908,7 @@ var csv_parse = (function (exports) {
59085908
if(finalErr) return finalErr;
59095909
}
59105910
}
5911-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5911+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
59125912
this.__resetRecord();
59135913
return;
59145914
}

packages/csv-parse/dist/iife/sync.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5452,11 +5452,11 @@ var csv_parse_sync = (function (exports) {
54525452
}else {
54535453
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
54545454
}
5455-
// Normalize option `skip_lines_with_empty_values`
5456-
if(typeof options.skip_lines_with_empty_values === 'boolean');else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){
5457-
options.skip_lines_with_empty_values = false;
5455+
// Normalize option `skip_records_with_empty_values`
5456+
if(typeof options.skip_records_with_empty_values === 'boolean');else if(options.skip_records_with_empty_values === undefined || options.skip_records_with_empty_values === null){
5457+
options.skip_records_with_empty_values = false;
54585458
}else {
5459-
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
5459+
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54605460
}
54615461
// Normalize option `skip_lines_with_error`
54625462
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
@@ -5859,15 +5859,15 @@ var csv_parse_sync = (function (exports) {
58595859
}
58605860
}
58615861
__onRecord(){
5862-
const {columns, columns_duplicates_to_array, encoding, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_lines_with_empty_values} = this.options;
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;
58635863
const {enabled, record} = this.state;
58645864
if(enabled === false){
58655865
return this.__resetRecord();
58665866
}
58675867
// Convert the first line into column names
58685868
const recordLength = record.length;
58695869
if(columns === true){
5870-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5870+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
58715871
this.__resetRecord();
58725872
return;
58735873
}
@@ -5908,7 +5908,7 @@ var csv_parse_sync = (function (exports) {
59085908
if(finalErr) return finalErr;
59095909
}
59105910
}
5911-
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
5911+
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
59125912
this.__resetRecord();
59135913
return;
59145914
}

0 commit comments

Comments
 (0)