Skip to content

Commit a5ccef3

Browse files
authored
Array Object "Expansion" - Add Deep-CSV Conversion for Objects in Arrays (#103)
* feat: add array object expansion functionality * Allow for objects appearing in array values to be expanded and deep-converted to CSV. * fix: remaining behavior fixes after latest deeks update * Fixes handling with duplicate key issue using the new option in the deeks module (from mrodrig/deeks#6). Adds functionality for #102. * chore(release): 3.2.0
1 parent 5f7ad3d commit a5ccef3

14 files changed

+1560
-12
lines changed

README.md

+21-4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,23 @@ Upgrading to v3 from v2? Check out the [upgrade guide](https://github.com/mrodri
5555
* `emptyFieldValue` - Any - Value that, if specified, will be substituted in for field values that are `undefined`, `null`, or an empty string.
5656
* Default: none
5757
* `excelBOM` - Boolean - Should a unicode character be prepended to allow Excel to open a UTF-8 encoded file with non-ASCII characters present.
58+
* `expandArrayObjects` - Boolean - Should objects in array values be deep-converted to CSV?
59+
* Example:
60+
```json
61+
[
62+
{
63+
"specifications": [
64+
{ "features": [...] },
65+
{ "mileage": "5000" }
66+
]
67+
}
68+
]
69+
```
70+
* `true` uses the following keys:
71+
* `['specifications.features', 'specifications.mileage']`
72+
* `false` uses the following keys:
73+
* `['specifications']`
74+
* Note: This may result in CSV output that does not map back exactly to the original JSON. See #102 for more information.
5875
* `keys` - Array - Specify the keys (as strings) that should be converted.
5976
* Default: `null`
6077
* If you have a nested object (ie. {info : {name: 'Mike'}}), then set this to ['info.name']
@@ -117,10 +134,10 @@ $ npm run coverage
117134

118135
Current Coverage is:
119136
```
120-
Statements : 100% ( 261/261 )
121-
Branches : 100% ( 131/131 )
122-
Functions : 100% ( 47/47 )
123-
Lines : 100% ( 256/256 )
137+
Statements : 100% ( 272/272 )
138+
Branches : 100% ( 143/143 )
139+
Functions : 100% ( 49/49 )
140+
Lines : 100% ( 266/266 )
124141
```
125142

126143
## Frequently Asked Questions (FAQ)

0 commit comments

Comments
 (0)