csv-parse
Advanced tools
Comparing version 4.6.3 to 4.6.4
@@ -11,2 +11,8 @@ | ||
## Version 4.6.4 | ||
* errors: don't stringify/parse undefined and null values | ||
* errors: expose CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE | ||
* errors: expose CSV_MAX_RECORD_SIZE | ||
## Version 4.6.3 | ||
@@ -13,0 +19,0 @@ |
@@ -715,3 +715,3 @@ "use strict"; | ||
if (max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size) { | ||
var _err2 = this.__error("Max Record Size: record exceed the maximum number of tolerated bytes of ".concat(max_record_size, " on line ").concat(this.info.lines)); | ||
var _err2 = this.__error(new CsvError('CSV_MAX_RECORD_SIZE', ['Max Record Size:', 'record exceed the maximum number of tolerated bytes', "of ".concat(max_record_size), "at line ".concat(this.info.lines)], this.__context())); | ||
@@ -729,3 +729,3 @@ if (_err2 !== undefined) return _err2; | ||
} else if (rtrim === true && !this.__isCharTrimable(chr)) { | ||
var _err3 = this.__error("Invalid Closing Quote: found non trimable byte after quote at line ".concat(this.info.lines)); | ||
var _err3 = this.__error(new CsvError('CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE', ['Invalid Closing Quote:', 'found non trimable byte after quote', "at line ".concat(this.info.lines)], this.__context())); | ||
@@ -1221,4 +1221,4 @@ if (_err3 !== undefined) return _err3; | ||
for (var key in context) { | ||
var value = Buffer.isBuffer(context[key]) ? context[key].toString() : context[key]; | ||
_this2[key] = JSON.parse(JSON.stringify(value)); | ||
var value = context[key]; | ||
_this2[key] = Buffer.isBuffer(value) ? value.toString() : value == null ? value : JSON.parse(JSON.stringify(value)); | ||
} | ||
@@ -1225,0 +1225,0 @@ } |
@@ -559,3 +559,10 @@ | ||
if(max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size){ | ||
const err = this.__error(`Max Record Size: record exceed the maximum number of tolerated bytes of ${max_record_size} on line ${this.info.lines}`) | ||
const err = this.__error( | ||
new CsvError('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.__context()) | ||
) | ||
if(err !== undefined) return err | ||
@@ -571,3 +578,9 @@ } | ||
}else if(rtrim === true && !this.__isCharTrimable(chr)){ | ||
const err = this.__error(`Invalid Closing Quote: found non trimable byte after quote at line ${this.info.lines}`) | ||
const err = this.__error( | ||
new CsvError('CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE', [ | ||
'Invalid Closing Quote:', | ||
'found non trimable byte after quote', | ||
`at line ${this.info.lines}`, | ||
], this.__context()) | ||
) | ||
if(err !== undefined) return err | ||
@@ -961,4 +974,4 @@ } | ||
for(const key in context){ | ||
const value = Buffer.isBuffer(context[key]) ? context[key].toString() : context[key] | ||
this[key] = JSON.parse(JSON.stringify(value)) | ||
const value = context[key] | ||
this[key] = Buffer.isBuffer(value) ? value.toString() : value == null ? value : JSON.parse(JSON.stringify(value)) | ||
} | ||
@@ -965,0 +978,0 @@ } |
{ | ||
"version": "4.6.3", | ||
"version": "4.6.4", | ||
"name": "csv-parse", | ||
@@ -4,0 +4,0 @@ "description": "CSV parsing implementing the Node.js `stream.Transform` API", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122480
2540