'columns' unparse config not working when first object doesn't have all properties
See original GitHub issueWhen using the columns
unparse config option together with a data array where the first object does not have all properties that are listed in the columns
array, then not all columns of the columns
array are used even if later objects have these values.
E.g.
const columns= ["First", "Second", "Third"];
const rows= [
{ First: "1-1"},
{
First: "2-1",
Second: "2-2",
"Third": "2-3",
},
];
const result = Papa.unparse(
{ data: rows},
{
header: true,
columns: columns,
}
);
console.log(result)
The result
is
First
1-1
2-1
instead of the expected
First,Second,Third
1-1,,
2-1,2-2,2-3
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Mapping an index over more than one column across entity ...
I need to generate migration for my entity "Contact" has the "Complex Type -> Address". So far so good! However, in the "Contact"...
Read more >Generated Values - EF Core - Microsoft Learn
How to configure value generation for properties when using Entity Framework Core.
Read more >How to update a key of object with value in json column with ...
What you're passing into update is a JS object (docs). You cannot have multiple keys with identical values (docs). You'll have to do...
Read more >Entities - typeorm - GitBook
Basic entities consist of columns and relations. Each entity MUST have a primary column (or ObjectId column if are using MongoDB).
Read more >Content Configuration - Tailwind CSS
Configuring source paths. Tailwind CSS works by scanning all of your HTML, JavaScript components, and any other template files for class names, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I guess the problem is that the columns array is modified on the first colum when it should not be. Could you please upload a PR to fix it which includes a minimum test case (your example sounds like a good solution)
Generally, I am wondering whether the options
columns
andfields
are not the same thing andcolumns
could therefore be removed?