Comparing version 2.3.1 to 2.4.0
@@ -0,1 +1,5 @@ | ||
# v2.4.0 | ||
* Allow renaming headers. [#175](https://github.com/C2FO/fast-csv/pull/175) | ||
# v2.3.1 | ||
@@ -2,0 +6,0 @@ |
@@ -36,2 +36,3 @@ var extended = require("../extended"), | ||
this._headers = options.headers; | ||
this._renameHeaders = options.renameHeaders; | ||
this._ignoreEmpty = options.ignoreEmpty; | ||
@@ -118,2 +119,3 @@ this._discardUnmappedColumns = options.discardUnmappedColumns; | ||
var headers = this._headers, | ||
renameHeaders = this._renameHeaders, | ||
discardUnmappedColumns = this._discardUnmappedColumns, | ||
@@ -147,3 +149,3 @@ strictColumnHandling = this._strictColumnHandling, | ||
if (isUndefined(headers[i])) { | ||
continue; | ||
continue; | ||
} | ||
@@ -161,3 +163,10 @@ val = data[i]; | ||
if (extended.isBoolean(headers) && headers) { | ||
if (renameHeaders) { | ||
if (Array.isArray(headers)) { | ||
rows.shift(); | ||
headerHandler(null, headers); | ||
} else { | ||
self.emit("error", new Error("Error renaming headers: new headers must be provided in an array")); | ||
} | ||
} else if (extended.isBoolean(headers) && headers) { | ||
this.__handleLine(rows.shift(), 0, true, headerHandler); | ||
@@ -205,5 +214,5 @@ } else { | ||
if (data && typeof data == 'string' && data.charCodeAt(0) == '0xFEFF') { | ||
return data.slice(1); | ||
} | ||
return data; | ||
return data.slice(1); | ||
} | ||
return data; | ||
}, | ||
@@ -210,0 +219,0 @@ |
{ | ||
"name": "fast-csv", | ||
"version": "2.3.1", | ||
"version": "2.4.0", | ||
"description": "CSV parser and writer", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
6
64275
17
972