Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(csv): infer column names from object arrays for stringify() #6122

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

efekrskl
Copy link

Implements #3857

Allows usages like below by deriving the column names from the first array item

const data = [{ a: 1 }, { a: 2 }, { b: 3 }];
stringify(data);

@efekrskl efekrskl requested a review from kt3k as a code owner October 16, 2024 22:21
@CLAassistant
Copy link

CLAassistant commented Oct 16, 2024

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the csv label Oct 16, 2024
Comment on lines -76 to -89
await t.step(
{
name: "Invalid data, no columns",
fn() {
const data = [{ a: 1 }, { a: 2 }];
assertThrows(
() => stringify(data),
TypeError,
"No property accessor function was provided for object",
);
},
},
);
await t.step(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like these were duplicates, removed both as they are not relevant anymore

@efekrskl efekrskl changed the title csv: stringify infer column names from object arrays feat(csv): infer column names from object arrays for stringify() Oct 16, 2024
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.55%. Comparing base (45be5d3) to head (a35ac58).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6122      +/-   ##
==========================================
- Coverage   96.57%   96.55%   -0.03%     
==========================================
  Files         535      535              
  Lines       40583    40600      +17     
  Branches     6094     6099       +5     
==========================================
+ Hits        39195    39203       +8     
- Misses       1344     1352       +8     
- Partials       44       45       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants