Skip to content

Commit 6489511

Browse files
committed
1 parent 3639780 commit 6489511

File tree

14 files changed

+87
-38
lines changed

14 files changed

+87
-38
lines changed

demo/esm/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [0.0.13](https://github.com/adaltas/node-csv/compare/[email protected]@0.0.13) (2022-11-28)
7+
8+
**Note:** Version bump only for package csv-demo-esm
9+
10+
11+
12+
13+
614
## [0.0.12](https://github.com/adaltas/node-csv/compare/[email protected]@0.0.12) (2022-11-22)
715

816
**Note:** Version bump only for package csv-demo-esm

demo/esm/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "csv-demo-esm",
3-
"version": "0.0.12",
3+
"version": "0.0.13",
44
"main": "index.js",
55
"license": "MIT",
66
"type": "module",
77
"private": true,
88
"dependencies": {
9-
"csv": "^6.2.3",
10-
"csv-parse": "^5.3.2"
9+
"csv": "^6.2.4",
10+
"csv-parse": "^5.3.3"
1111
},
1212
"devDependencies": {
1313
"coffeescript": "^2.7.0",

packages/csv-parse/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [5.3.3](https://github.com/adaltas/node-csv/compare/[email protected]@5.3.3) (2022-11-28)
7+
8+
9+
### Bug Fixes
10+
11+
* **csv-parse:** improve INVALID_OPENING_QUOTE error message (fix adaltas/node-csv-docs[#120](https://github.com/adaltas/node-csv/issues/120)) ([3639780](https://github.com/adaltas/node-csv/commit/36397800a9b479658e6497bb521a27c037fc3abb))
12+
13+
14+
615
## [5.3.2](https://github.com/adaltas/node-csv/compare/[email protected]@5.3.2) (2022-11-08)
716

817

packages/csv-parse/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "5.3.2",
2+
"version": "5.3.3",
33
"name": "csv-parse",
44
"description": "CSV parsing implementing the Node.js `stream.Transform` API",
55
"keywords": [

packages/csv/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [6.2.4](https://github.com/adaltas/node-csv/compare/[email protected]@6.2.4) (2022-11-28)
7+
8+
**Note:** Version bump only for package csv
9+
10+
11+
12+
13+
614
## [6.2.3](https://github.com/adaltas/node-csv/compare/[email protected]@6.2.3) (2022-11-22)
715

816
**Note:** Version bump only for package csv

packages/csv/dist/cjs/index.cjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ const is_object$1 = function(obj){
264264

265265
let CsvError$1 = class CsvError extends Error {
266266
constructor(code, message, options, ...contexts) {
267-
if(Array.isArray(message)) message = message.join(' ');
267+
if(Array.isArray(message)) message = message.join(' ').trim();
268268
super(message);
269269
if(Error.captureStackTrace !== undefined){
270270
Error.captureStackTrace(this, CsvError$1);
@@ -895,7 +895,7 @@ const transform$1 = function(original_options = {}) {
895895
},
896896
// Central parser implementation
897897
parse: function(nextBuf, end, push, close){
898-
const {bom, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
898+
const {bom, encoding, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
899899
let {comment, escape, quote, record_delimiter} = this.options;
900900
const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state;
901901
let buf;
@@ -1031,11 +1031,14 @@ const transform$1 = function(original_options = {}) {
10311031
if(this.state.field.length !== 0){
10321032
// In relax_quotes mode, treat opening quote preceded by chrs as regular
10331033
if(relax_quotes === false){
1034+
const info = this.__infoField();
1035+
const bom = Object.keys(boms).map(b => boms[b].equals(this.state.field.toString()) ? b : false).filter(Boolean)[0];
10341036
const err = this.__error(
10351037
new CsvError$1('INVALID_OPENING_QUOTE', [
10361038
'Invalid Opening Quote:',
1037-
`a quote is found inside a field at line ${this.info.lines}`,
1038-
], this.options, this.__infoField(), {
1039+
`a quote is found on field ${JSON.stringify(info.column)} at line ${info.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`,
1040+
bom ? `(${bom} bom)` : undefined
1041+
], this.options, info, {
10391042
field: this.state.field,
10401043
})
10411044
);

packages/csv/dist/cjs/sync.cjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ const generate = function(options){
257257

258258
let CsvError$1 = class CsvError extends Error {
259259
constructor(code, message, options, ...contexts) {
260-
if(Array.isArray(message)) message = message.join(' ');
260+
if(Array.isArray(message)) message = message.join(' ').trim();
261261
super(message);
262262
if(Error.captureStackTrace !== undefined){
263263
Error.captureStackTrace(this, CsvError$1);
@@ -892,7 +892,7 @@ const transform$1 = function(original_options = {}) {
892892
},
893893
// Central parser implementation
894894
parse: function(nextBuf, end, push, close){
895-
const {bom, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
895+
const {bom, encoding, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
896896
let {comment, escape, quote, record_delimiter} = this.options;
897897
const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state;
898898
let buf;
@@ -1028,11 +1028,14 @@ const transform$1 = function(original_options = {}) {
10281028
if(this.state.field.length !== 0){
10291029
// In relax_quotes mode, treat opening quote preceded by chrs as regular
10301030
if(relax_quotes === false){
1031+
const info = this.__infoField();
1032+
const bom = Object.keys(boms).map(b => boms[b].equals(this.state.field.toString()) ? b : false).filter(Boolean)[0];
10311033
const err = this.__error(
10321034
new CsvError$1('INVALID_OPENING_QUOTE', [
10331035
'Invalid Opening Quote:',
1034-
`a quote is found inside a field at line ${this.info.lines}`,
1035-
], this.options, this.__infoField(), {
1036+
`a quote is found on field ${JSON.stringify(info.column)} at line ${info.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`,
1037+
bom ? `(${bom} bom)` : undefined
1038+
], this.options, info, {
10361039
field: this.state.field,
10371040
})
10381041
);

packages/csv/dist/esm/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5391,7 +5391,7 @@ const is_object$1 = function(obj){
53915391

53925392
let CsvError$1 = class CsvError extends Error {
53935393
constructor(code, message, options, ...contexts) {
5394-
if(Array.isArray(message)) message = message.join(' ');
5394+
if(Array.isArray(message)) message = message.join(' ').trim();
53955395
super(message);
53965396
if(Error.captureStackTrace !== undefined){
53975397
Error.captureStackTrace(this, CsvError$1);
@@ -6022,7 +6022,7 @@ const transform$1 = function(original_options = {}) {
60226022
},
60236023
// Central parser implementation
60246024
parse: function(nextBuf, end, push, close){
6025-
const {bom, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
6025+
const {bom, encoding, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
60266026
let {comment, escape, quote, record_delimiter} = this.options;
60276027
const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state;
60286028
let buf;
@@ -6158,11 +6158,14 @@ const transform$1 = function(original_options = {}) {
61586158
if(this.state.field.length !== 0){
61596159
// In relax_quotes mode, treat opening quote preceded by chrs as regular
61606160
if(relax_quotes === false){
6161+
const info = this.__infoField();
6162+
const bom = Object.keys(boms).map(b => boms[b].equals(this.state.field.toString()) ? b : false).filter(Boolean)[0];
61616163
const err = this.__error(
61626164
new CsvError$1('INVALID_OPENING_QUOTE', [
61636165
'Invalid Opening Quote:',
6164-
`a quote is found inside a field at line ${this.info.lines}`,
6165-
], this.options, this.__infoField(), {
6166+
`a quote is found on field ${JSON.stringify(info.column)} at line ${info.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`,
6167+
bom ? `(${bom} bom)` : undefined
6168+
], this.options, info, {
61666169
field: this.state.field,
61676170
})
61686171
);

packages/csv/dist/esm/sync.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5384,7 +5384,7 @@ const generate = function(options){
53845384

53855385
let CsvError$1 = class CsvError extends Error {
53865386
constructor(code, message, options, ...contexts) {
5387-
if(Array.isArray(message)) message = message.join(' ');
5387+
if(Array.isArray(message)) message = message.join(' ').trim();
53885388
super(message);
53895389
if(Error.captureStackTrace !== undefined){
53905390
Error.captureStackTrace(this, CsvError$1);
@@ -6019,7 +6019,7 @@ const transform$1 = function(original_options = {}) {
60196019
},
60206020
// Central parser implementation
60216021
parse: function(nextBuf, end, push, close){
6022-
const {bom, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
6022+
const {bom, encoding, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
60236023
let {comment, escape, quote, record_delimiter} = this.options;
60246024
const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state;
60256025
let buf;
@@ -6155,11 +6155,14 @@ const transform$1 = function(original_options = {}) {
61556155
if(this.state.field.length !== 0){
61566156
// In relax_quotes mode, treat opening quote preceded by chrs as regular
61576157
if(relax_quotes === false){
6158+
const info = this.__infoField();
6159+
const bom = Object.keys(boms).map(b => boms[b].equals(this.state.field.toString()) ? b : false).filter(Boolean)[0];
61586160
const err = this.__error(
61596161
new CsvError$1('INVALID_OPENING_QUOTE', [
61606162
'Invalid Opening Quote:',
6161-
`a quote is found inside a field at line ${this.info.lines}`,
6162-
], this.options, this.__infoField(), {
6163+
`a quote is found on field ${JSON.stringify(info.column)} at line ${info.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`,
6164+
bom ? `(${bom} bom)` : undefined
6165+
], this.options, info, {
61636166
field: this.state.field,
61646167
})
61656168
);

packages/csv/dist/iife/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5394,7 +5394,7 @@ var csv = (function (exports) {
53945394

53955395
let CsvError$1 = class CsvError extends Error {
53965396
constructor(code, message, options, ...contexts) {
5397-
if(Array.isArray(message)) message = message.join(' ');
5397+
if(Array.isArray(message)) message = message.join(' ').trim();
53985398
super(message);
53995399
if(Error.captureStackTrace !== undefined){
54005400
Error.captureStackTrace(this, CsvError$1);
@@ -6025,7 +6025,7 @@ var csv = (function (exports) {
60256025
},
60266026
// Central parser implementation
60276027
parse: function(nextBuf, end, push, close){
6028-
const {bom, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
6028+
const {bom, encoding, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
60296029
let {comment, escape, quote, record_delimiter} = this.options;
60306030
const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state;
60316031
let buf;
@@ -6161,11 +6161,14 @@ var csv = (function (exports) {
61616161
if(this.state.field.length !== 0){
61626162
// In relax_quotes mode, treat opening quote preceded by chrs as regular
61636163
if(relax_quotes === false){
6164+
const info = this.__infoField();
6165+
const bom = Object.keys(boms).map(b => boms[b].equals(this.state.field.toString()) ? b : false).filter(Boolean)[0];
61646166
const err = this.__error(
61656167
new CsvError$1('INVALID_OPENING_QUOTE', [
61666168
'Invalid Opening Quote:',
6167-
`a quote is found inside a field at line ${this.info.lines}`,
6168-
], this.options, this.__infoField(), {
6169+
`a quote is found on field ${JSON.stringify(info.column)} at line ${info.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`,
6170+
bom ? `(${bom} bom)` : undefined
6171+
], this.options, info, {
61696172
field: this.state.field,
61706173
})
61716174
);

packages/csv/dist/iife/sync.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5387,7 +5387,7 @@ var csv_sync = (function (exports) {
53875387

53885388
let CsvError$1 = class CsvError extends Error {
53895389
constructor(code, message, options, ...contexts) {
5390-
if(Array.isArray(message)) message = message.join(' ');
5390+
if(Array.isArray(message)) message = message.join(' ').trim();
53915391
super(message);
53925392
if(Error.captureStackTrace !== undefined){
53935393
Error.captureStackTrace(this, CsvError$1);
@@ -6022,7 +6022,7 @@ var csv_sync = (function (exports) {
60226022
},
60236023
// Central parser implementation
60246024
parse: function(nextBuf, end, push, close){
6025-
const {bom, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
6025+
const {bom, encoding, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
60266026
let {comment, escape, quote, record_delimiter} = this.options;
60276027
const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state;
60286028
let buf;
@@ -6158,11 +6158,14 @@ var csv_sync = (function (exports) {
61586158
if(this.state.field.length !== 0){
61596159
// In relax_quotes mode, treat opening quote preceded by chrs as regular
61606160
if(relax_quotes === false){
6161+
const info = this.__infoField();
6162+
const bom = Object.keys(boms).map(b => boms[b].equals(this.state.field.toString()) ? b : false).filter(Boolean)[0];
61616163
const err = this.__error(
61626164
new CsvError$1('INVALID_OPENING_QUOTE', [
61636165
'Invalid Opening Quote:',
6164-
`a quote is found inside a field at line ${this.info.lines}`,
6165-
], this.options, this.__infoField(), {
6166+
`a quote is found on field ${JSON.stringify(info.column)} at line ${info.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`,
6167+
bom ? `(${bom} bom)` : undefined
6168+
], this.options, info, {
61666169
field: this.state.field,
61676170
})
61686171
);

packages/csv/dist/umd/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5397,7 +5397,7 @@
53975397

53985398
let CsvError$1 = class CsvError extends Error {
53995399
constructor(code, message, options, ...contexts) {
5400-
if(Array.isArray(message)) message = message.join(' ');
5400+
if(Array.isArray(message)) message = message.join(' ').trim();
54015401
super(message);
54025402
if(Error.captureStackTrace !== undefined){
54035403
Error.captureStackTrace(this, CsvError$1);
@@ -6028,7 +6028,7 @@
60286028
},
60296029
// Central parser implementation
60306030
parse: function(nextBuf, end, push, close){
6031-
const {bom, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
6031+
const {bom, encoding, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
60326032
let {comment, escape, quote, record_delimiter} = this.options;
60336033
const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state;
60346034
let buf;
@@ -6164,11 +6164,14 @@
61646164
if(this.state.field.length !== 0){
61656165
// In relax_quotes mode, treat opening quote preceded by chrs as regular
61666166
if(relax_quotes === false){
6167+
const info = this.__infoField();
6168+
const bom = Object.keys(boms).map(b => boms[b].equals(this.state.field.toString()) ? b : false).filter(Boolean)[0];
61676169
const err = this.__error(
61686170
new CsvError$1('INVALID_OPENING_QUOTE', [
61696171
'Invalid Opening Quote:',
6170-
`a quote is found inside a field at line ${this.info.lines}`,
6171-
], this.options, this.__infoField(), {
6172+
`a quote is found on field ${JSON.stringify(info.column)} at line ${info.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`,
6173+
bom ? `(${bom} bom)` : undefined
6174+
], this.options, info, {
61726175
field: this.state.field,
61736176
})
61746177
);

packages/csv/dist/umd/sync.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5390,7 +5390,7 @@
53905390

53915391
let CsvError$1 = class CsvError extends Error {
53925392
constructor(code, message, options, ...contexts) {
5393-
if(Array.isArray(message)) message = message.join(' ');
5393+
if(Array.isArray(message)) message = message.join(' ').trim();
53945394
super(message);
53955395
if(Error.captureStackTrace !== undefined){
53965396
Error.captureStackTrace(this, CsvError$1);
@@ -6025,7 +6025,7 @@
60256025
},
60266026
// Central parser implementation
60276027
parse: function(nextBuf, end, push, close){
6028-
const {bom, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
6028+
const {bom, encoding, from_line, ltrim, max_record_size,raw, relax_quotes, rtrim, skip_empty_lines, to, to_line} = this.options;
60296029
let {comment, escape, quote, record_delimiter} = this.options;
60306030
const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state;
60316031
let buf;
@@ -6161,11 +6161,14 @@
61616161
if(this.state.field.length !== 0){
61626162
// In relax_quotes mode, treat opening quote preceded by chrs as regular
61636163
if(relax_quotes === false){
6164+
const info = this.__infoField();
6165+
const bom = Object.keys(boms).map(b => boms[b].equals(this.state.field.toString()) ? b : false).filter(Boolean)[0];
61646166
const err = this.__error(
61656167
new CsvError$1('INVALID_OPENING_QUOTE', [
61666168
'Invalid Opening Quote:',
6167-
`a quote is found inside a field at line ${this.info.lines}`,
6168-
], this.options, this.__infoField(), {
6169+
`a quote is found on field ${JSON.stringify(info.column)} at line ${info.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`,
6170+
bom ? `(${bom} bom)` : undefined
6171+
], this.options, info, {
61696172
field: this.state.field,
61706173
})
61716174
);

0 commit comments

Comments
 (0)