json-2-csv
Advanced tools
Comparing version 3.11.1 to 3.12.0
@@ -38,3 +38,4 @@ { | ||
"useLocaleFormat": false, | ||
"parseValue": null | ||
"parseValue": null, | ||
"wrapBooleans": false | ||
}, | ||
@@ -41,0 +42,0 @@ |
@@ -146,5 +146,8 @@ 'use strict'; | ||
function generateCsvHeader(params) { | ||
// #185 - generate a keys list to avoid finding native Map() methods | ||
let fieldTitleMapKeys = Object.keys(options.fieldTitleMap); | ||
params.header = params.headerFields | ||
.map(function(field) { | ||
const headerKey = options.fieldTitleMap[field] ? options.fieldTitleMap[field] : field; | ||
const headerKey = fieldTitleMapKeys.includes(field) ? options.fieldTitleMap[field] : field; | ||
return wrapFieldValueIfNecessary(headerKey); | ||
@@ -363,3 +366,4 @@ }) | ||
fieldValue.includes(options.delimiter.wrap) || | ||
fieldValue.match(crlfSearchRegex)) { | ||
fieldValue.match(crlfSearchRegex) || | ||
options.wrapBooleans && (fieldValue === 'true' || fieldValue === 'false')) { | ||
// wrap the field's value in a wrap delimiter (quotation marks by default) | ||
@@ -366,0 +370,0 @@ fieldValue = wrapDelimiter + fieldValue + wrapDelimiter; |
@@ -8,3 +8,3 @@ { | ||
"description": "A JSON to CSV and CSV to JSON converter that natively supports sub-documents and auto-generates the CSV heading.", | ||
"version": "3.11.1", | ||
"version": "3.12.0", | ||
"homepage": "https://mrodrig.github.io/json-2-csv", | ||
@@ -57,5 +57,5 @@ "repository": { | ||
"engines": { | ||
"node": ">= 10" | ||
"node": ">= 12" | ||
}, | ||
"license": "MIT" | ||
} |
@@ -141,2 +141,4 @@ # json-2-csv | ||
* Note: If selected, values will be converted using `toLocaleString()` rather than `toString()` | ||
* `wrapBooleans` - Boolean - Should boolean values be wrapped in wrap delimiters to prevent Excel from converting them to Excel's TRUE/FALSE Boolean values. | ||
* Default: `false` | ||
@@ -143,0 +145,0 @@ |
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
66214
1199
271