Skip to content

Commit 0376af7

Browse files
committed
refactor(csv-parse)!: rename skip_records_with_error
1 parent aa432c1 commit 0376af7

18 files changed

+96
-97
lines changed

packages/csv-parse/ROADMAP.md

-1
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_error`: rename to skip_records_with_error (easy)
87
* `max_comment_size`: new option (medium)
98
* promise: new API module (medium)
109
* errors: finish normalisation of all errors (easy)

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -5459,11 +5459,11 @@ class Parser extends Transform {
54595459
}else {
54605460
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54615461
}
5462-
// Normalize option `skip_lines_with_error`
5463-
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
5464-
options.skip_lines_with_error = false;
5462+
// Normalize option `skip_records_with_error`
5463+
if(typeof options.skip_records_with_error === 'boolean');else if(options.skip_records_with_error === undefined || options.skip_records_with_error === null){
5464+
options.skip_records_with_error = false;
54655465
}else {
5466-
throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`);
5466+
throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`);
54675467
}
54685468
// Normalize option `rtrim`
54695469
if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){
@@ -5903,7 +5903,7 @@ class Parser extends Transform {
59035903
(relax_column_count_more === true && recordLength > this.state.expectedRecordLength)){
59045904
this.info.invalid_field_length++;
59055905
this.state.error = err;
5906-
// Error is undefined with skip_lines_with_error
5906+
// Error is undefined with skip_records_with_error
59075907
}else {
59085908
const finalErr = this.__error(err);
59095909
if(finalErr) return finalErr;
@@ -6201,9 +6201,9 @@ class Parser extends Transform {
62016201
return 0;
62026202
}
62036203
__error(msg){
6204-
const {encoding, raw, skip_lines_with_error} = this.options;
6204+
const {encoding, raw, skip_records_with_error} = this.options;
62056205
const err = typeof msg === 'string' ? new Error(msg) : msg;
6206-
if(skip_lines_with_error){
6206+
if(skip_records_with_error){
62076207
this.state.recordHasError = true;
62086208
this.emit('skip', err, raw ? this.state.rawBuffer.toString(encoding) : undefined);
62096209
return undefined;

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ export interface Options {
186186
/**
187187
* Skip a line with error found inside and directly go process the next line.
188188
*/
189-
skip_lines_with_error?: boolean;
190-
skipLinesWithError?: boolean;
189+
skip_records_with_error?: boolean;
190+
skipRecordsWithError?: boolean;
191191
/**
192192
* Don't generate records for lines containing empty column values (column matching /\s*\/), defaults to false.
193193
*/

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -5459,11 +5459,11 @@ class Parser extends Transform {
54595459
}else {
54605460
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54615461
}
5462-
// Normalize option `skip_lines_with_error`
5463-
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
5464-
options.skip_lines_with_error = false;
5462+
// Normalize option `skip_records_with_error`
5463+
if(typeof options.skip_records_with_error === 'boolean');else if(options.skip_records_with_error === undefined || options.skip_records_with_error === null){
5464+
options.skip_records_with_error = false;
54655465
}else {
5466-
throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`);
5466+
throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`);
54675467
}
54685468
// Normalize option `rtrim`
54695469
if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){
@@ -5903,7 +5903,7 @@ class Parser extends Transform {
59035903
(relax_column_count_more === true && recordLength > this.state.expectedRecordLength)){
59045904
this.info.invalid_field_length++;
59055905
this.state.error = err;
5906-
// Error is undefined with skip_lines_with_error
5906+
// Error is undefined with skip_records_with_error
59075907
}else {
59085908
const finalErr = this.__error(err);
59095909
if(finalErr) return finalErr;
@@ -6201,9 +6201,9 @@ class Parser extends Transform {
62016201
return 0;
62026202
}
62036203
__error(msg){
6204-
const {encoding, raw, skip_lines_with_error} = this.options;
6204+
const {encoding, raw, skip_records_with_error} = this.options;
62056205
const err = typeof msg === 'string' ? new Error(msg) : msg;
6206-
if(skip_lines_with_error){
6206+
if(skip_records_with_error){
62076207
this.state.recordHasError = true;
62086208
this.emit('skip', err, raw ? this.state.rawBuffer.toString(encoding) : undefined);
62096209
return undefined;

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ export interface Options {
186186
/**
187187
* Skip a line with error found inside and directly go process the next line.
188188
*/
189-
skip_lines_with_error?: boolean;
190-
skipLinesWithError?: boolean;
189+
skip_records_with_error?: boolean;
190+
skipRecordsWithError?: boolean;
191191
/**
192192
* Don't generate records for lines containing empty column values (column matching /\s*\/), defaults to false.
193193
*/

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -5455,11 +5455,11 @@ class Parser extends Transform {
54555455
}else {
54565456
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54575457
}
5458-
// Normalize option `skip_lines_with_error`
5459-
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
5460-
options.skip_lines_with_error = false;
5458+
// Normalize option `skip_records_with_error`
5459+
if(typeof options.skip_records_with_error === 'boolean');else if(options.skip_records_with_error === undefined || options.skip_records_with_error === null){
5460+
options.skip_records_with_error = false;
54615461
}else {
5462-
throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`);
5462+
throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`);
54635463
}
54645464
// Normalize option `rtrim`
54655465
if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){
@@ -5899,7 +5899,7 @@ class Parser extends Transform {
58995899
(relax_column_count_more === true && recordLength > this.state.expectedRecordLength)){
59005900
this.info.invalid_field_length++;
59015901
this.state.error = err;
5902-
// Error is undefined with skip_lines_with_error
5902+
// Error is undefined with skip_records_with_error
59035903
}else {
59045904
const finalErr = this.__error(err);
59055905
if(finalErr) return finalErr;
@@ -6197,9 +6197,9 @@ class Parser extends Transform {
61976197
return 0;
61986198
}
61996199
__error(msg){
6200-
const {encoding, raw, skip_lines_with_error} = this.options;
6200+
const {encoding, raw, skip_records_with_error} = this.options;
62016201
const err = typeof msg === 'string' ? new Error(msg) : msg;
6202-
if(skip_lines_with_error){
6202+
if(skip_records_with_error){
62036203
this.state.recordHasError = true;
62046204
this.emit('skip', err, raw ? this.state.rawBuffer.toString(encoding) : undefined);
62056205
return undefined;

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -5455,11 +5455,11 @@ class Parser extends Transform {
54555455
}else {
54565456
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54575457
}
5458-
// Normalize option `skip_lines_with_error`
5459-
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
5460-
options.skip_lines_with_error = false;
5458+
// Normalize option `skip_records_with_error`
5459+
if(typeof options.skip_records_with_error === 'boolean');else if(options.skip_records_with_error === undefined || options.skip_records_with_error === null){
5460+
options.skip_records_with_error = false;
54615461
}else {
5462-
throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`);
5462+
throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`);
54635463
}
54645464
// Normalize option `rtrim`
54655465
if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){
@@ -5899,7 +5899,7 @@ class Parser extends Transform {
58995899
(relax_column_count_more === true && recordLength > this.state.expectedRecordLength)){
59005900
this.info.invalid_field_length++;
59015901
this.state.error = err;
5902-
// Error is undefined with skip_lines_with_error
5902+
// Error is undefined with skip_records_with_error
59035903
}else {
59045904
const finalErr = this.__error(err);
59055905
if(finalErr) return finalErr;
@@ -6197,9 +6197,9 @@ class Parser extends Transform {
61976197
return 0;
61986198
}
61996199
__error(msg){
6200-
const {encoding, raw, skip_lines_with_error} = this.options;
6200+
const {encoding, raw, skip_records_with_error} = this.options;
62016201
const err = typeof msg === 'string' ? new Error(msg) : msg;
6202-
if(skip_lines_with_error){
6202+
if(skip_records_with_error){
62036203
this.state.recordHasError = true;
62046204
this.emit('skip', err, raw ? this.state.rawBuffer.toString(encoding) : undefined);
62056205
return undefined;

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -5458,11 +5458,11 @@ var csv_parse = (function (exports) {
54585458
}else {
54595459
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54605460
}
5461-
// Normalize option `skip_lines_with_error`
5462-
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
5463-
options.skip_lines_with_error = false;
5461+
// Normalize option `skip_records_with_error`
5462+
if(typeof options.skip_records_with_error === 'boolean');else if(options.skip_records_with_error === undefined || options.skip_records_with_error === null){
5463+
options.skip_records_with_error = false;
54645464
}else {
5465-
throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`);
5465+
throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`);
54665466
}
54675467
// Normalize option `rtrim`
54685468
if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){
@@ -5902,7 +5902,7 @@ var csv_parse = (function (exports) {
59025902
(relax_column_count_more === true && recordLength > this.state.expectedRecordLength)){
59035903
this.info.invalid_field_length++;
59045904
this.state.error = err;
5905-
// Error is undefined with skip_lines_with_error
5905+
// Error is undefined with skip_records_with_error
59065906
}else {
59075907
const finalErr = this.__error(err);
59085908
if(finalErr) return finalErr;
@@ -6200,9 +6200,9 @@ var csv_parse = (function (exports) {
62006200
return 0;
62016201
}
62026202
__error(msg){
6203-
const {encoding, raw, skip_lines_with_error} = this.options;
6203+
const {encoding, raw, skip_records_with_error} = this.options;
62046204
const err = typeof msg === 'string' ? new Error(msg) : msg;
6205-
if(skip_lines_with_error){
6205+
if(skip_records_with_error){
62066206
this.state.recordHasError = true;
62076207
this.emit('skip', err, raw ? this.state.rawBuffer.toString(encoding) : undefined);
62086208
return undefined;

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -5458,11 +5458,11 @@ var csv_parse_sync = (function (exports) {
54585458
}else {
54595459
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54605460
}
5461-
// Normalize option `skip_lines_with_error`
5462-
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
5463-
options.skip_lines_with_error = false;
5461+
// Normalize option `skip_records_with_error`
5462+
if(typeof options.skip_records_with_error === 'boolean');else if(options.skip_records_with_error === undefined || options.skip_records_with_error === null){
5463+
options.skip_records_with_error = false;
54645464
}else {
5465-
throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`);
5465+
throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`);
54665466
}
54675467
// Normalize option `rtrim`
54685468
if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){
@@ -5902,7 +5902,7 @@ var csv_parse_sync = (function (exports) {
59025902
(relax_column_count_more === true && recordLength > this.state.expectedRecordLength)){
59035903
this.info.invalid_field_length++;
59045904
this.state.error = err;
5905-
// Error is undefined with skip_lines_with_error
5905+
// Error is undefined with skip_records_with_error
59065906
}else {
59075907
const finalErr = this.__error(err);
59085908
if(finalErr) return finalErr;
@@ -6200,9 +6200,9 @@ var csv_parse_sync = (function (exports) {
62006200
return 0;
62016201
}
62026202
__error(msg){
6203-
const {encoding, raw, skip_lines_with_error} = this.options;
6203+
const {encoding, raw, skip_records_with_error} = this.options;
62046204
const err = typeof msg === 'string' ? new Error(msg) : msg;
6205-
if(skip_lines_with_error){
6205+
if(skip_records_with_error){
62066206
this.state.recordHasError = true;
62076207
this.emit('skip', err, raw ? this.state.rawBuffer.toString(encoding) : undefined);
62086208
return undefined;

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -5461,11 +5461,11 @@
54615461
}else {
54625462
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54635463
}
5464-
// Normalize option `skip_lines_with_error`
5465-
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
5466-
options.skip_lines_with_error = false;
5464+
// Normalize option `skip_records_with_error`
5465+
if(typeof options.skip_records_with_error === 'boolean');else if(options.skip_records_with_error === undefined || options.skip_records_with_error === null){
5466+
options.skip_records_with_error = false;
54675467
}else {
5468-
throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`);
5468+
throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`);
54695469
}
54705470
// Normalize option `rtrim`
54715471
if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){
@@ -5905,7 +5905,7 @@
59055905
(relax_column_count_more === true && recordLength > this.state.expectedRecordLength)){
59065906
this.info.invalid_field_length++;
59075907
this.state.error = err;
5908-
// Error is undefined with skip_lines_with_error
5908+
// Error is undefined with skip_records_with_error
59095909
}else {
59105910
const finalErr = this.__error(err);
59115911
if(finalErr) return finalErr;
@@ -6203,9 +6203,9 @@
62036203
return 0;
62046204
}
62056205
__error(msg){
6206-
const {encoding, raw, skip_lines_with_error} = this.options;
6206+
const {encoding, raw, skip_records_with_error} = this.options;
62076207
const err = typeof msg === 'string' ? new Error(msg) : msg;
6208-
if(skip_lines_with_error){
6208+
if(skip_records_with_error){
62096209
this.state.recordHasError = true;
62106210
this.emit('skip', err, raw ? this.state.rawBuffer.toString(encoding) : undefined);
62116211
return undefined;

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -5461,11 +5461,11 @@
54615461
}else {
54625462
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
54635463
}
5464-
// Normalize option `skip_lines_with_error`
5465-
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
5466-
options.skip_lines_with_error = false;
5464+
// Normalize option `skip_records_with_error`
5465+
if(typeof options.skip_records_with_error === 'boolean');else if(options.skip_records_with_error === undefined || options.skip_records_with_error === null){
5466+
options.skip_records_with_error = false;
54675467
}else {
5468-
throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`);
5468+
throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`);
54695469
}
54705470
// Normalize option `rtrim`
54715471
if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){
@@ -5905,7 +5905,7 @@
59055905
(relax_column_count_more === true && recordLength > this.state.expectedRecordLength)){
59065906
this.info.invalid_field_length++;
59075907
this.state.error = err;
5908-
// Error is undefined with skip_lines_with_error
5908+
// Error is undefined with skip_records_with_error
59095909
}else {
59105910
const finalErr = this.__error(err);
59115911
if(finalErr) return finalErr;
@@ -6203,9 +6203,9 @@
62036203
return 0;
62046204
}
62056205
__error(msg){
6206-
const {encoding, raw, skip_lines_with_error} = this.options;
6206+
const {encoding, raw, skip_records_with_error} = this.options;
62076207
const err = typeof msg === 'string' ? new Error(msg) : msg;
6208-
if(skip_lines_with_error){
6208+
if(skip_records_with_error){
62096209
this.state.recordHasError = true;
62106210
this.emit('skip', err, raw ? this.state.rawBuffer.toString(encoding) : undefined);
62116211
return undefined;

packages/csv-parse/lib/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ export interface Options {
186186
/**
187187
* Skip a line with error found inside and directly go process the next line.
188188
*/
189-
skip_lines_with_error?: boolean;
190-
skipLinesWithError?: boolean;
189+
skip_records_with_error?: boolean;
190+
skipRecordsWithError?: boolean;
191191
/**
192192
* Don't generate records for lines containing empty column values (column matching /\s*\/), defaults to false.
193193
*/

0 commit comments

Comments
 (0)