Comparing version
@@ -5,2 +5,9 @@ # Changelog | ||
### [5.0.7](https://github.com/zemirco/json2csv/compare/v5.0.6...v5.0.7) (2022-02-23) | ||
### Bug Fixes | ||
* unwind transform issue with nested arrays ([#549](https://github.com/zemirco/json2csv/issues/549)) ([485ea77](https://github.com/zemirco/json2csv/commit/485ea77886f1e09d768ed1cce0af6faeb06707cf)) | ||
### [5.0.6](https://github.com/zemirco/json2csv/compare/v5.0.5...v5.0.6) (2021-02-03) | ||
@@ -7,0 +14,0 @@ |
@@ -10,4 +10,6 @@ 'use strict'; | ||
const [key, ...restPath] = pathArray; | ||
const newValue = pathArray.length > 1 ? setProp(obj[key] || {}, restPath, value) : value; | ||
return Object.assign({}, obj, { [key]: newValue }); | ||
return { | ||
...obj, | ||
[key]: pathArray.length > 1 ? setProp(obj[key] || {}, restPath, value) : value | ||
}; | ||
} | ||
@@ -31,3 +33,7 @@ | ||
return unsetProp(obj[key], restPath); | ||
return Object.keys(obj) | ||
.reduce((acc, prop) => ({ | ||
...acc, | ||
[prop]: prop !== key ? obj[prop] : unsetProp(obj[key], restPath), | ||
}), {}); | ||
} | ||
@@ -34,0 +40,0 @@ |
{ | ||
"name": "json2csv", | ||
"version": "5.0.6", | ||
"version": "5.0.7", | ||
"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
383177
0.46%9439
0.4%