Update generated content

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-09-02 18:35:05 +02:00
parent 3139e8d280
commit 5681933133
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7

13
dist/index.js generated vendored
View File

@ -6771,6 +6771,7 @@ class Parser extends Transform {
} }
} }
this.info = { this.info = {
bytes: 0,
comment_lines: 0, comment_lines: 0,
empty_lines: 0, empty_lines: 0,
invalid_field_length: 0, invalid_field_length: 0,
@ -6780,6 +6781,7 @@ class Parser extends Transform {
this.options = options this.options = options
this.state = { this.state = {
bomSkipped: false, bomSkipped: false,
bufBytesStart: 0,
castField: fnCastField, castField: fnCastField,
commenting: false, commenting: false,
// Current error encountered by a record // Current error encountered by a record
@ -6866,7 +6868,9 @@ class Parser extends Transform {
for(let encoding in boms){ for(let encoding in boms){
if(boms[encoding].compare(buf, 0, boms[encoding].length) === 0){ if(boms[encoding].compare(buf, 0, boms[encoding].length) === 0){
// Skip BOM // Skip BOM
buf = buf.slice(boms[encoding].length) let bomLength = boms[encoding].length
this.state.bufBytesStart += bomLength
buf = buf.slice(bomLength)
// Renormalize original options with the new encoding // Renormalize original options with the new encoding
this.__normalizeOptions({...this.__originalOptions, encoding: encoding}) this.__normalizeOptions({...this.__originalOptions, encoding: encoding})
break break
@ -7006,8 +7010,10 @@ class Parser extends Transform {
pos += recordDelimiterLength - 1 pos += recordDelimiterLength - 1
continue continue
} }
this.info.bytes = this.state.bufBytesStart + pos;
const errField = this.__onField() const errField = this.__onField()
if(errField !== undefined) return errField if(errField !== undefined) return errField
this.info.bytes = this.state.bufBytesStart + pos + recordDelimiterLength;
const errRecord = this.__onRecord() const errRecord = this.__onRecord()
if(errRecord !== undefined) return errRecord if(errRecord !== undefined) return errRecord
if(to !== -1 && this.info.records >= to){ if(to !== -1 && this.info.records >= to){
@ -7030,6 +7036,7 @@ class Parser extends Transform {
} }
let delimiterLength = this.__isDelimiter(buf, pos, chr) let delimiterLength = this.__isDelimiter(buf, pos, chr)
if(delimiterLength !== 0){ if(delimiterLength !== 0){
this.info.bytes = this.state.bufBytesStart + pos;
const errField = this.__onField() const errField = this.__onField()
if(errField !== undefined) return errField if(errField !== undefined) return errField
pos += delimiterLength - 1 pos += delimiterLength - 1
@ -7079,6 +7086,7 @@ class Parser extends Transform {
}else{ }else{
// Skip last line if it has no characters // Skip last line if it has no characters
if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){ if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){
this.info.bytes = this.state.bufBytesStart + pos;
const errField = this.__onField() const errField = this.__onField()
if(errField !== undefined) return errField if(errField !== undefined) return errField
const errRecord = this.__onRecord() const errRecord = this.__onRecord()
@ -7090,6 +7098,7 @@ class Parser extends Transform {
} }
} }
}else{ }else{
this.state.bufBytesStart += pos
this.state.previousBuf = buf.slice(pos) this.state.previousBuf = buf.slice(pos)
} }
if(this.state.wasRowDelimiter === true){ if(this.state.wasRowDelimiter === true){
@ -7504,7 +7513,7 @@ const parse = function(){
throw new CsvError('CSV_INVALID_ARGUMENT', [ throw new CsvError('CSV_INVALID_ARGUMENT', [
'Invalid argument:', 'Invalid argument:',
`got ${JSON.stringify(argument)} at index ${i}` `got ${JSON.stringify(argument)} at index ${i}`
], this.options) ], options || {})
} }
} }
const parser = new Parser(options) const parser = new Parser(options)