csv-parser
Advanced tools
Comparing version 2.3.4 to 2.3.5
11
index.js
@@ -179,11 +179,10 @@ const { Transform } = require('stream') | ||
writeRow (cells) { | ||
const headers = (this.headers === false) ? cells.map((value, index) => index) : this.headers | ||
if (this.headers === false || cells.length > this.headers.length) { | ||
this.headers = cells.map((value, index) => index) | ||
} | ||
const row = cells.reduce((o, cell, index) => { | ||
const header = headers[index] | ||
if (header === null) return o // skip columns | ||
if (header !== undefined) { | ||
const header = this.headers[index] | ||
if (header !== null) { | ||
o[header] = cell | ||
} else { | ||
o[`_${index}`] = cell | ||
} | ||
@@ -190,0 +189,0 @@ return o |
{ | ||
"name": "csv-parser", | ||
"version": "2.3.4", | ||
"version": "2.3.5", | ||
"description": "Streaming CSV parser that aims for maximum speed as well as compatibility with the csv-spectrum test suite", | ||
@@ -23,3 +23,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">= 10" | ||
"node": ">= 8.16.0" | ||
}, | ||
@@ -36,3 +36,4 @@ "scripts": { | ||
"dependencies": { | ||
"minimist": "^1.2.0" | ||
"minimist": "^1.2.0", | ||
"through2": "^3.0.1" | ||
}, | ||
@@ -39,0 +40,0 @@ "devDependencies": { |
@@ -254,9 +254,5 @@ [tests]: http://img.shields.io/travis/mafintosh/csv-parser.svg | ||
Type: `Boolean`<br> | ||
Default: `false` | ||
If `true`, instructs the parser that the number of columns in each row must match | ||
the number of `headers` specified or throws an exception. | ||
if `false`: the headers are mapped to the column index | ||
less columns: any missing column in the middle will result in a wrong property mapping! | ||
more columns: the aditional columns will create a "_"+index properties - eg. "_10":"value" | ||
the number of `headers` specified. | ||
@@ -263,0 +259,0 @@ ## Events |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
27327
2
354
355
+ Addedthrough2@^3.0.1
+ Addedinherits@2.0.4(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedthrough2@3.0.2(transitive)
+ Addedutil-deprecate@1.0.2(transitive)