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

Custom sorting of headers #216

Closed
4 of 5 tasks
mebibou opened this issue Jan 14, 2022 · 2 comments
Closed
4 of 5 tasks

Custom sorting of headers #216

mebibou opened this issue Jan 14, 2022 · 2 comments
Labels

Comments

@mebibou
Copy link
Contributor

mebibou commented Jan 14, 2022

Background Information

  • Module Version: 3.14.4
  • Node/Browser Version: 12.22.6

The issue I'm reporting is with:

  • json2csv
  • csv2json

I have...

  • searched to see if an issue has already been reported.
  • verified that my JSON/CSV data is valid (using something like http://jsonlint.com or https://csvlint.io/).
  • tried upgrading to the latest version of json-2-csv (since the issue may already be fixed).

It would be useful to be able to use a function rather than just a boolean for the sortHeader option. So it would look like

{
  sortHeader: (a, b) => 1
}

So like a typical javascript sort function

@mrodrig
Copy link
Owner

mrodrig commented Jan 15, 2022

Thanks for reporting this @mebibou. That's a great idea and a very nice feature to have. Thanks for the PR too!

@mrodrig
Copy link
Owner

mrodrig commented Jan 15, 2022

Released on NPM as 3.16.0. Thanks again!

@mrodrig mrodrig closed this as completed Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants