Skip to content

Commit

Permalink
refactor(csv-parse)!: rename skip_records_with_empty_values
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Nov 6, 2021
1 parent 9fffd50 commit aa432c1
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 90 deletions.
1 change: 0 additions & 1 deletion packages/csv-parse/ROADMAP.md
Expand Up @@ -4,7 +4,6 @@ Below is the list of upgrades we are considering for the next major release. The

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.

* `skip_lines_with_empty_values`: rename to skip_records_with_empty_values (easy)
* `skip_lines_with_error`: rename to skip_records_with_error (easy)
* `max_comment_size`: new option (medium)
* promise: new API module (medium)
Expand Down
14 changes: 7 additions & 7 deletions packages/csv-parse/dist/cjs/index.cjs
Expand Up @@ -5453,11 +5453,11 @@ class Parser extends Transform {
}else {
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
}
// Normalize option `skip_lines_with_empty_values`
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){
options.skip_lines_with_empty_values = false;
// Normalize option `skip_records_with_empty_values`
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){
options.skip_records_with_empty_values = false;
}else {
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
}
// Normalize option `skip_lines_with_error`
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
Expand Down Expand Up @@ -5860,15 +5860,15 @@ class Parser extends Transform {
}
}
__onRecord(){
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;
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;
const {enabled, record} = this.state;
if(enabled === false){
return this.__resetRecord();
}
// Convert the first line into column names
const recordLength = record.length;
if(columns === true){
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down Expand Up @@ -5909,7 +5909,7 @@ class Parser extends Transform {
if(finalErr) return finalErr;
}
}
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/csv-parse/dist/cjs/index.d.ts
Expand Up @@ -191,8 +191,8 @@ export interface Options {
/**
* Don't generate records for lines containing empty column values (column matching /\s*\/), defaults to false.
*/
skip_lines_with_empty_values?: boolean;
skipLinesWithEmptyValues?: boolean;
skip_records_with_empty_values?: boolean;
skipRecordsWithEmptyValues?: boolean;
/**
* Stop handling records after the requested number of records.
*/
Expand Down
14 changes: 7 additions & 7 deletions packages/csv-parse/dist/cjs/sync.cjs
Expand Up @@ -5453,11 +5453,11 @@ class Parser extends Transform {
}else {
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
}
// Normalize option `skip_lines_with_empty_values`
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){
options.skip_lines_with_empty_values = false;
// Normalize option `skip_records_with_empty_values`
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){
options.skip_records_with_empty_values = false;
}else {
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
}
// Normalize option `skip_lines_with_error`
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
Expand Down Expand Up @@ -5860,15 +5860,15 @@ class Parser extends Transform {
}
}
__onRecord(){
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;
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;
const {enabled, record} = this.state;
if(enabled === false){
return this.__resetRecord();
}
// Convert the first line into column names
const recordLength = record.length;
if(columns === true){
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down Expand Up @@ -5909,7 +5909,7 @@ class Parser extends Transform {
if(finalErr) return finalErr;
}
}
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/csv-parse/dist/esm/index.d.ts
Expand Up @@ -191,8 +191,8 @@ export interface Options {
/**
* Don't generate records for lines containing empty column values (column matching /\s*\/), defaults to false.
*/
skip_lines_with_empty_values?: boolean;
skipLinesWithEmptyValues?: boolean;
skip_records_with_empty_values?: boolean;
skipRecordsWithEmptyValues?: boolean;
/**
* Stop handling records after the requested number of records.
*/
Expand Down
14 changes: 7 additions & 7 deletions packages/csv-parse/dist/esm/index.js
Expand Up @@ -5449,11 +5449,11 @@ class Parser extends Transform {
}else {
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
}
// Normalize option `skip_lines_with_empty_values`
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){
options.skip_lines_with_empty_values = false;
// Normalize option `skip_records_with_empty_values`
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){
options.skip_records_with_empty_values = false;
}else {
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
}
// Normalize option `skip_lines_with_error`
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
Expand Down Expand Up @@ -5856,15 +5856,15 @@ class Parser extends Transform {
}
}
__onRecord(){
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;
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;
const {enabled, record} = this.state;
if(enabled === false){
return this.__resetRecord();
}
// Convert the first line into column names
const recordLength = record.length;
if(columns === true){
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down Expand Up @@ -5905,7 +5905,7 @@ class Parser extends Transform {
if(finalErr) return finalErr;
}
}
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down
14 changes: 7 additions & 7 deletions packages/csv-parse/dist/esm/sync.js
Expand Up @@ -5449,11 +5449,11 @@ class Parser extends Transform {
}else {
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
}
// Normalize option `skip_lines_with_empty_values`
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){
options.skip_lines_with_empty_values = false;
// Normalize option `skip_records_with_empty_values`
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){
options.skip_records_with_empty_values = false;
}else {
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
}
// Normalize option `skip_lines_with_error`
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
Expand Down Expand Up @@ -5856,15 +5856,15 @@ class Parser extends Transform {
}
}
__onRecord(){
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;
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;
const {enabled, record} = this.state;
if(enabled === false){
return this.__resetRecord();
}
// Convert the first line into column names
const recordLength = record.length;
if(columns === true){
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down Expand Up @@ -5905,7 +5905,7 @@ class Parser extends Transform {
if(finalErr) return finalErr;
}
}
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down
14 changes: 7 additions & 7 deletions packages/csv-parse/dist/iife/index.js
Expand Up @@ -5452,11 +5452,11 @@ var csv_parse = (function (exports) {
}else {
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
}
// Normalize option `skip_lines_with_empty_values`
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){
options.skip_lines_with_empty_values = false;
// Normalize option `skip_records_with_empty_values`
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){
options.skip_records_with_empty_values = false;
}else {
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
}
// Normalize option `skip_lines_with_error`
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
Expand Down Expand Up @@ -5859,15 +5859,15 @@ var csv_parse = (function (exports) {
}
}
__onRecord(){
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;
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;
const {enabled, record} = this.state;
if(enabled === false){
return this.__resetRecord();
}
// Convert the first line into column names
const recordLength = record.length;
if(columns === true){
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down Expand Up @@ -5908,7 +5908,7 @@ var csv_parse = (function (exports) {
if(finalErr) return finalErr;
}
}
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down
14 changes: 7 additions & 7 deletions packages/csv-parse/dist/iife/sync.js
Expand Up @@ -5452,11 +5452,11 @@ var csv_parse_sync = (function (exports) {
}else {
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`);
}
// Normalize option `skip_lines_with_empty_values`
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){
options.skip_lines_with_empty_values = false;
// Normalize option `skip_records_with_empty_values`
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){
options.skip_records_with_empty_values = false;
}else {
throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`);
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`);
}
// Normalize option `skip_lines_with_error`
if(typeof options.skip_lines_with_error === 'boolean');else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){
Expand Down Expand Up @@ -5859,15 +5859,15 @@ var csv_parse_sync = (function (exports) {
}
}
__onRecord(){
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;
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;
const {enabled, record} = this.state;
if(enabled === false){
return this.__resetRecord();
}
// Convert the first line into column names
const recordLength = record.length;
if(columns === true){
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down Expand Up @@ -5908,7 +5908,7 @@ var csv_parse_sync = (function (exports) {
if(finalErr) return finalErr;
}
}
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
if(skip_records_with_empty_values === true && isRecordEmpty(record)){
this.__resetRecord();
return;
}
Expand Down

0 comments on commit aa432c1

Please sign in to comment.