Comparing version 4.0.1 to 4.0.2
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="4.0.2"></a> | ||
## [4.0.2](https://github.com/zemirco/json2csv/compare/v4.0.1...v4.0.2) (2018-03-09) | ||
### Bug Fixes | ||
* **parser:** RangeError ([#271](https://github.com/zemirco/json2csv/issues/271)) ([c8d5a87](https://github.com/zemirco/json2csv/commit/c8d5a87)) | ||
<a name="4.0.1"></a> | ||
@@ -7,0 +17,0 @@ ## [4.0.1](https://github.com/zemirco/json2csv/compare/v4.0.0...v4.0.1) (2018-03-05) |
@@ -65,2 +65,3 @@ 'use strict'; | ||
: [row]; | ||
if (this.opts.flatten) { | ||
@@ -235,28 +236,26 @@ return processedRow.map(this.flatten); | ||
unwindData(dataRow, unwindPaths) { | ||
return Array.prototype.concat.apply([], | ||
unwindPaths.reduce((data, unwindPath) => | ||
Array.prototype.concat.apply([], | ||
data.map((dataEl) => { | ||
const unwindArray = lodashGet(dataEl, unwindPath); | ||
return unwindPaths | ||
.reduce((data, unwindPath) => | ||
data.map((dataEl) => { | ||
const unwindArray = lodashGet(dataEl, unwindPath); | ||
if (!Array.isArray(unwindArray)) { | ||
return dataEl; | ||
} | ||
if (!Array.isArray(unwindArray)) { | ||
return dataEl; | ||
} | ||
if (unwindArray.length) { | ||
return unwindArray.map((unwindEl) => { | ||
const dataCopy = lodashCloneDeep(dataEl); | ||
lodashSet(dataCopy, unwindPath, unwindEl); | ||
return dataCopy; | ||
}); | ||
} | ||
if (unwindArray.length) { | ||
return unwindArray.map((unwindEl) => { | ||
const dataCopy = lodashCloneDeep(dataEl); | ||
lodashSet(dataCopy, unwindPath, unwindEl); | ||
return dataCopy; | ||
}); | ||
} | ||
const dataCopy = lodashCloneDeep(dataEl); | ||
lodashSet(dataCopy, unwindPath, undefined); | ||
return dataCopy; | ||
}) | ||
), | ||
[dataRow] | ||
) | ||
const dataCopy = lodashCloneDeep(dataEl); | ||
lodashSet(dataCopy, unwindPath, undefined); | ||
return dataCopy; | ||
}).reduce((tempData, rows) => tempData.concat(rows), []), | ||
[dataRow] | ||
) | ||
.reduce((tempData, rows) => tempData.concat(rows), []); | ||
} | ||
@@ -263,0 +262,0 @@ } |
@@ -16,5 +16,6 @@ 'use strict'; | ||
if (!this.opts.fields) { | ||
const dataFields = Array.prototype.concat.apply([], | ||
processedData.map(item => Object.keys(item)) | ||
); | ||
const dataFields = processedData | ||
.map(item => Object.keys(item)) | ||
.reduce((tempData, rows) => tempData.concat(rows), []); | ||
this.opts.fields = dataFields | ||
@@ -47,5 +48,5 @@ .filter((field, pos, arr) => arr.indexOf(field) == pos); | ||
return Array.prototype.concat.apply([], | ||
processedData.map(row => this.preprocessRow(row)) | ||
); | ||
return processedData | ||
.map(row => this.preprocessRow(row)) | ||
.reduce((tempData, rows) => tempData.concat(rows), []); | ||
} | ||
@@ -52,0 +53,0 @@ |
{ | ||
"name": "json2csv", | ||
"preferGlobal": "true", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Convert JSON to CSV", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
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
893678
27122