-
Notifications
You must be signed in to change notification settings - Fork 632
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
CSV - option to automatically infer headers #3857
Comments
just want to mention that this works if you pass the columns options console.log(stringify(arr, { columns: ["a", "b"] })); without it it errors with
|
@sigmaSd thank you for the suggestion! It helped me to simplify my little wrapper to auto-stringify an array of objects export class Csv {
static stringify(array: Record<string, unknown>[]) {
const columns = Object.keys(array[0]);
return stringify(array, { columns }).trim();
}
} |
I like this idea! Thoughts, @kt3k? |
In the mean while, shouldn't |
Related: #2660 |
Closing as duplicate of #2660. |
@iuioiua This is a feature request for auto-inferring headers, the way mature CSV libraries do. #2660 is an issue about marking the @sergeysolovev: can you please rename this issue to "CSV - option to automatically infer headers" or something similar? |
@dandv alright, ready |
Strange that csv is now stable but these issues are not resolved yet. |
This is a feature request, not a bug. It can be added as a non-breaking change, so it wasn't a blocker for stabilization. Also, PRs are welcome. |
It would be amazing if this code worked, probably by passing something like
inferHeaders
option (suggested by @crowlKats).The text was updated successfully, but these errors were encountered: