Comparing version 5.0.5 to 5.0.6
@@ -5,2 +5,9 @@ # Changelog | ||
### [5.0.6](https://github.com/zemirco/json2csv/compare/v5.0.5...v5.0.6) (2021-02-03) | ||
### Bug Fixes | ||
* Escape quotes excel ([#512](https://github.com/zemirco/json2csv/issues/512)) ([ab3bf8a](https://github.com/zemirco/json2csv/commit/ab3bf8ad3ce64cff7d6149e1b70f92b71bebf6c7)) | ||
### [5.0.5](https://github.com/zemirco/json2csv/compare/v5.0.4...v5.0.5) (2020-11-16) | ||
@@ -7,0 +14,0 @@ |
@@ -171,10 +171,12 @@ 'use strict'; | ||
if (typeof value === 'string') { | ||
if(value.includes(this.opts.quote)) { | ||
value = value.replace(new RegExp(this.opts.quote, 'g'), this.opts.escapedQuote); | ||
} | ||
value = `${this.opts.quote}${value}${this.opts.quote}`; | ||
if (this.opts.excelStrings) { | ||
value = `"="${value}""`; | ||
if(value.includes(this.opts.quote)) { | ||
value = value.replace(new RegExp(this.opts.quote, 'g'), `${this.opts.escapedQuote}${this.opts.escapedQuote}`); | ||
} | ||
value = `"=""${value}"""`; | ||
} else { | ||
if(value.includes(this.opts.quote)) { | ||
value = value.replace(new RegExp(this.opts.quote, 'g'), this.opts.escapedQuote); | ||
} | ||
value = `${this.opts.quote}${value}${this.opts.quote}`; | ||
} | ||
@@ -181,0 +183,0 @@ } |
{ | ||
"name": "json2csv", | ||
"version": "5.0.5", | ||
"version": "5.0.6", | ||
"description": "Convert JSON to CSV", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
381441
9401