hughsk / hughsk/flat

Empty objects are ignored by flatten

Open
#177 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.8k
Forks
197
PR merge metrics
No merged PRs in 30d

Description

I was using with `paraparase` and found that it ignores the empty object/array results in `[object/object]` in CSV download.

```
[
{
"token": "YCMG4IRRE6",
"payment": {
"currency": "USD",
"amount": 10
},
"tracking": {}
}
]

const flattenned = data.map((d) =>
flatten(d)
);
return Papa.unparse(flattenned);

```

![image](https://github.com/hughsk/flat/assets/6106479/4938f927-2f35-49dd-9507-6ca2a67fe0eb)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the supplied data transformation by passing the example object through flatten before Papa.unparse, and inspect how the empty tracking object and arrays are handled. Trace the flatten entry point and verify that the empty values are preserved instead of becoming [object/object] in the CSV output; done when the example produces the expected CSV behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.