Skip to content

Commit

Permalink
chore(release): publish
Browse files Browse the repository at this point in the history
 - csv-demo-esm@0.0.7
 - csv-issues-esm@0.0.3
 - csv-parse@5.2.1
 - csv@6.1.4
  • Loading branch information
wdavidw committed Jun 29, 2022
1 parent 8bf52f0 commit e8b4fc7
Show file tree
Hide file tree
Showing 16 changed files with 392 additions and 159 deletions.
8 changes: 8 additions & 0 deletions demo/esm/CHANGELOG.md
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

### [0.0.7](https://github.com/adaltas/node-csv/compare/csv-demo-esm@0.0.6...csv-demo-esm@0.0.7) (2022-06-29)

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





### [0.0.6](https://github.com/adaltas/node-csv/compare/csv-demo-esm@0.0.5...csv-demo-esm@0.0.6) (2022-06-16)

**Note:** Version bump only for package csv-demo-esm
Expand Down
6 changes: 3 additions & 3 deletions demo/esm/package.json
@@ -1,13 +1,13 @@
{
"name": "csv-demo-esm",
"version": "0.0.6",
"version": "0.0.7",
"main": "index.js",
"license": "MIT",
"type": "module",
"private": true,
"dependencies": {
"csv": "^6.1.3",
"csv-parse": "^5.2.0"
"csv": "^6.1.4",
"csv-parse": "^5.2.1"
},
"devDependencies": {
"coffeescript": "^2.7.0",
Expand Down
8 changes: 8 additions & 0 deletions demo/issues-esm/CHANGELOG.md
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

### [0.0.3](https://github.com/adaltas/node-csv/compare/csv-issues-esm@0.0.2...csv-issues-esm@0.0.3) (2022-06-29)

**Note:** Version bump only for package csv-issues-esm





### [0.0.2](https://github.com/adaltas/node-csv/compare/csv-issues-esm@0.0.1...csv-issues-esm@0.0.2) (2022-05-24)

**Note:** Version bump only for package csv-issues-esm
Expand Down
2 changes: 1 addition & 1 deletion demo/issues-esm/package.json
@@ -1,6 +1,6 @@
{
"name": "csv-issues-esm",
"version": "0.0.2",
"version": "0.0.3",
"main": "index.js",
"license": "MIT",
"type": "module",
Expand Down
9 changes: 9 additions & 0 deletions packages/csv-parse/CHANGELOG.md
Expand Up @@ -3,6 +3,15 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

### [5.2.1](https://github.com/adaltas/node-csv/compare/csv-parse@5.2.0...csv-parse@5.2.1) (2022-06-29)


### Bug Fixes

* **csv-parse:** rtrim encoding support (fix [#349](https://github.com/adaltas/node-csv/issues/349)) ([8bf52f0](https://github.com/adaltas/node-csv/commit/8bf52f0d5c25ee2423cb1629d3e9103534668c83))



## [5.2.0](https://github.com/adaltas/node-csv/compare/csv-parse@5.1.0...csv-parse@5.2.0) (2022-06-14)


Expand Down
2 changes: 1 addition & 1 deletion packages/csv-parse/package.json
@@ -1,5 +1,5 @@
{
"version": "5.2.0",
"version": "5.2.1",
"name": "csv-parse",
"description": "CSV parsing implementing the Node.js `stream.Transform` API",
"keywords": [
Expand Down
8 changes: 8 additions & 0 deletions packages/csv/CHANGELOG.md
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

### [6.1.4](https://github.com/adaltas/node-csv/compare/csv@6.1.3...csv@6.1.4) (2022-06-29)

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





### [6.1.3](https://github.com/adaltas/node-csv/compare/csv@6.1.2...csv@6.1.3) (2022-06-16)


Expand Down
63 changes: 44 additions & 19 deletions packages/csv/dist/cjs/index.cjs
Expand Up @@ -376,6 +376,16 @@ class ResizeableBuffer{
}
}

// white space characters
// https://en.wikipedia.org/wiki/Whitespace_character
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes#Types
// \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff
const np = 12;
const cr$1 = 13; // `\r`, carriage return, 0x0D in hexadécimal, 13 in decimal
const nl$1 = 10; // `\n`, newline, 0x0A in hexadecimal, 10 in decimal
const space = 32;
const tab = 9;

const init_state = function(options){
return {
bomSkipped: false,
Expand Down Expand Up @@ -409,7 +419,14 @@ const init_state = function(options){
recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 2 : Math.max(...options.record_delimiter.map((v) => v.length)),
trimChars: [Buffer.from(' ', options.encoding)[0], Buffer.from('\t', options.encoding)[0]],
wasQuoting: false,
wasRowDelimiter: false
wasRowDelimiter: false,
timchars: [
Buffer.from(Buffer.from([cr$1], 'utf8').toString(), options.encoding),
Buffer.from(Buffer.from([nl$1], 'utf8').toString(), options.encoding),
Buffer.from(Buffer.from([np], 'utf8').toString(), options.encoding),
Buffer.from(Buffer.from([space], 'utf8').toString(), options.encoding),
Buffer.from(Buffer.from([tab], 'utf8').toString(), options.encoding),
]
};
};

Expand Down Expand Up @@ -832,15 +849,9 @@ const isRecordEmpty = function(record){
return record.every((field) => field == null || field.toString && field.toString().trim() === '');
};

// white space characters
// https://en.wikipedia.org/wiki/Whitespace_character
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes#Types
// \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff
const tab = 9;
const nl = 10; // \n, 0x0A in hexadecimal, 10 in decimal
const np = 12;
const cr = 13; // \r, 0x0D in hexadécimal, 13 in decimal
const space = 32;
const cr = 13; // `\r`, carriage return, 0x0D in hexadécimal, 13 in decimal
const nl = 10; // `\n`, newline, 0x0A in hexadecimal, 10 in decimal

const boms = {
// Note, the following are equals:
// Buffer.from("\ufeff")
Expand Down Expand Up @@ -985,7 +996,7 @@ const transform$1 = function(original_options = {}) {
if(this.state.commenting === false && this.__isQuote(buf, pos)){
if(this.state.quoting === true){
const nextChr = buf[pos+quote.length];
const isNextChrTrimable = rtrim && this.__isCharTrimable(nextChr);
const isNextChrTrimable = rtrim && this.__isCharTrimable(buf, pos+quote.length);
const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos+quote.length, nextChr);
const isNextChrDelimiter = this.__isDelimiter(buf, pos+quote.length, nextChr);
const isNextChrRecordDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRecordDelimiter(buf, pos+quote.length) : this.__isRecordDelimiter(nextChr, buf, pos+quote.length);
Expand Down Expand Up @@ -1095,31 +1106,34 @@ const transform$1 = function(original_options = {}) {
}
if(this.state.commenting === false){
if(max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size){
const err = this.__error(
return this.__error(
new CsvError$1('CSV_MAX_RECORD_SIZE', [
'Max Record Size:',
'record exceed the maximum number of tolerated bytes',
`of ${max_record_size}`,
`at line ${this.info.lines}`,
], this.options, this.__infoField())
);
if(err !== undefined) return err;
}
}
const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr);
const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(buf, pos);
// rtrim in non quoting is handle in __onField
const rappend = rtrim === false || this.state.wasQuoting === false;
if(lappend === true && rappend === true){
this.state.field.append(chr);
}else if(rtrim === true && !this.__isCharTrimable(chr)){
const err = this.__error(
}else if(rtrim === true && !this.__isCharTrimable(buf, pos)){
return this.__error(
new CsvError$1('CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE', [
'Invalid Closing Quote:',
'found non trimable byte after quote',
`at line ${this.info.lines}`,
], this.options, this.__infoField())
);
if(err !== undefined) return err;
}else {
if(lappend === false){
pos += this.__isCharTrimable(buf, pos) - 1;
}
continue;
}
}
if(end === true){
Expand Down Expand Up @@ -1376,8 +1390,19 @@ const transform$1 = function(original_options = {}) {
return [undefined, field];
},
// Helper to test if a character is a space or a line delimiter
__isCharTrimable: function(chr){
return chr === space || chr === tab || chr === cr || chr === nl || chr === np;
__isCharTrimable: function(buf, pos){
const isTrim = (buf, pos) => {
const {timchars} = this.state;
loop1: for(let i = 0; i < timchars.length; i++){
const timchar = timchars[i];
for(let j = 0; j < timchar.length; j++){
if(timchar[j] !== buf[pos+j]) continue loop1;
}
return timchar.length;
}
return 0;
};
return isTrim(buf, pos);
},
// Keep it in case we implement the `cast_int` option
// __isInt(value){
Expand Down
63 changes: 44 additions & 19 deletions packages/csv/dist/cjs/sync.cjs
Expand Up @@ -373,6 +373,16 @@ class ResizeableBuffer{
}
}

// white space characters
// https://en.wikipedia.org/wiki/Whitespace_character
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes#Types
// \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff
const np = 12;
const cr$1 = 13; // `\r`, carriage return, 0x0D in hexadécimal, 13 in decimal
const nl$1 = 10; // `\n`, newline, 0x0A in hexadecimal, 10 in decimal
const space = 32;
const tab = 9;

const init_state = function(options){
return {
bomSkipped: false,
Expand Down Expand Up @@ -406,7 +416,14 @@ const init_state = function(options){
recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 2 : Math.max(...options.record_delimiter.map((v) => v.length)),
trimChars: [Buffer.from(' ', options.encoding)[0], Buffer.from('\t', options.encoding)[0]],
wasQuoting: false,
wasRowDelimiter: false
wasRowDelimiter: false,
timchars: [
Buffer.from(Buffer.from([cr$1], 'utf8').toString(), options.encoding),
Buffer.from(Buffer.from([nl$1], 'utf8').toString(), options.encoding),
Buffer.from(Buffer.from([np], 'utf8').toString(), options.encoding),
Buffer.from(Buffer.from([space], 'utf8').toString(), options.encoding),
Buffer.from(Buffer.from([tab], 'utf8').toString(), options.encoding),
]
};
};

Expand Down Expand Up @@ -829,15 +846,9 @@ const isRecordEmpty = function(record){
return record.every((field) => field == null || field.toString && field.toString().trim() === '');
};

// white space characters
// https://en.wikipedia.org/wiki/Whitespace_character
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes#Types
// \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff
const tab = 9;
const nl = 10; // \n, 0x0A in hexadecimal, 10 in decimal
const np = 12;
const cr = 13; // \r, 0x0D in hexadécimal, 13 in decimal
const space = 32;
const cr = 13; // `\r`, carriage return, 0x0D in hexadécimal, 13 in decimal
const nl = 10; // `\n`, newline, 0x0A in hexadecimal, 10 in decimal

const boms = {
// Note, the following are equals:
// Buffer.from("\ufeff")
Expand Down Expand Up @@ -982,7 +993,7 @@ const transform$1 = function(original_options = {}) {
if(this.state.commenting === false && this.__isQuote(buf, pos)){
if(this.state.quoting === true){
const nextChr = buf[pos+quote.length];
const isNextChrTrimable = rtrim && this.__isCharTrimable(nextChr);
const isNextChrTrimable = rtrim && this.__isCharTrimable(buf, pos+quote.length);
const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos+quote.length, nextChr);
const isNextChrDelimiter = this.__isDelimiter(buf, pos+quote.length, nextChr);
const isNextChrRecordDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRecordDelimiter(buf, pos+quote.length) : this.__isRecordDelimiter(nextChr, buf, pos+quote.length);
Expand Down Expand Up @@ -1092,31 +1103,34 @@ const transform$1 = function(original_options = {}) {
}
if(this.state.commenting === false){
if(max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size){
const err = this.__error(
return this.__error(
new CsvError$1('CSV_MAX_RECORD_SIZE', [
'Max Record Size:',
'record exceed the maximum number of tolerated bytes',
`of ${max_record_size}`,
`at line ${this.info.lines}`,
], this.options, this.__infoField())
);
if(err !== undefined) return err;
}
}
const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr);
const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(buf, pos);
// rtrim in non quoting is handle in __onField
const rappend = rtrim === false || this.state.wasQuoting === false;
if(lappend === true && rappend === true){
this.state.field.append(chr);
}else if(rtrim === true && !this.__isCharTrimable(chr)){
const err = this.__error(
}else if(rtrim === true && !this.__isCharTrimable(buf, pos)){
return this.__error(
new CsvError$1('CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE', [
'Invalid Closing Quote:',
'found non trimable byte after quote',
`at line ${this.info.lines}`,
], this.options, this.__infoField())
);
if(err !== undefined) return err;
}else {
if(lappend === false){
pos += this.__isCharTrimable(buf, pos) - 1;
}
continue;
}
}
if(end === true){
Expand Down Expand Up @@ -1373,8 +1387,19 @@ const transform$1 = function(original_options = {}) {
return [undefined, field];
},
// Helper to test if a character is a space or a line delimiter
__isCharTrimable: function(chr){
return chr === space || chr === tab || chr === cr || chr === nl || chr === np;
__isCharTrimable: function(buf, pos){
const isTrim = (buf, pos) => {
const {timchars} = this.state;
loop1: for(let i = 0; i < timchars.length; i++){
const timchar = timchars[i];
for(let j = 0; j < timchar.length; j++){
if(timchar[j] !== buf[pos+j]) continue loop1;
}
return timchar.length;
}
return 0;
};
return isTrim(buf, pos);
},
// Keep it in case we implement the `cast_int` option
// __isInt(value){
Expand Down

0 comments on commit e8b4fc7

Please sign in to comment.