Merge pull request #131 from docker/dependabot/npm_and_yarn/csv-parse-4.16.3

Bump csv-parse from 4.16.0 to 4.16.3
This commit is contained in:
CrazyMax 2021-09-03 13:51:18 +02:00 committed by GitHub
commit 6d43bfb301
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 8 deletions

15
dist/index.js generated vendored
View File

@ -10378,7 +10378,7 @@ class Parser extends Transform {
const date = Date.parse(value) const date = Date.parse(value)
return !isNaN(date) ? new Date(date) : value return !isNaN(date) ? new Date(date) : value
} }
}else if(typeof options.cast_date !== 'function'){ }else{
throw new CsvError('CSV_INVALID_OPTION_CAST_DATE', [ throw new CsvError('CSV_INVALID_OPTION_CAST_DATE', [
'Invalid option cast_date:', 'cast_date must be true or a function,', 'Invalid option cast_date:', 'cast_date must be true or a function,',
`got ${JSON.stringify(options.cast_date)}` `got ${JSON.stringify(options.cast_date)}`
@ -10714,6 +10714,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,
@ -10723,6 +10724,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
@ -10809,7 +10811,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
@ -10949,8 +10953,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){
@ -10973,6 +10979,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
@ -11022,6 +11029,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()
@ -11033,6 +11041,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){
@ -11447,7 +11456,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)

View File

@ -32,7 +32,7 @@
"@actions/core": "^1.5.0", "@actions/core": "^1.5.0",
"@actions/github": "^5.0.0", "@actions/github": "^5.0.0",
"@renovate/pep440": "^1.0.0", "@renovate/pep440": "^1.0.0",
"csv-parse": "^4.16.0", "csv-parse": "^4.16.3",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"moment": "^2.29.1", "moment": "^2.29.1",
"semver": "^7.3.5" "semver": "^7.3.5"

View File

@ -1256,10 +1256,10 @@ cssstyle@^2.3.0:
dependencies: dependencies:
cssom "~0.3.6" cssom "~0.3.6"
csv-parse@^4.16.0: csv-parse@^4.16.3:
version "4.16.0" version "4.16.3"
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.16.0.tgz#b4c875e288a41f7ff917cb0d7d45880d563034f6" resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.16.3.tgz#7ca624d517212ebc520a36873c3478fa66efbaf7"
integrity sha512-Zb4tGPANH4SW0LgC9+s9Mnequs9aqn7N3/pCqNbVjs2XhEF6yWNU2Vm4OGl1v2Go9nw8rXt87Cm2QN/o6Vpqgg== integrity sha512-cO1I/zmz4w2dcKHVvpCr7JVRu8/FymG5OEpmvsZYlccYolPBLoVGKUHgNoc4ZGkFeFlWGEDmMyBM+TTqRdW/wg==
data-urls@^2.0.0: data-urls@^2.0.0:
version "2.0.0" version "2.0.0"