adaltas / node-csv

Full featured CSV parser with simple api and tested against large datasets.
https://csv.js.org
MIT License
3.98k stars 263 forks source link

support headers as comment #419

Open bluelovers opened 7 months ago

bluelovers commented 7 months ago

Summary

A clear and concise description of what the feature is.

Motivation

If the feature is related to a problem, describe it. Add any other context explaining why this feature is of interest to you and the community.

Alternative

A clear and concise description of alternative solutions or features you've considered.

Draft

something like this

if (options?.headers_as_comment)
    {
        const headers = columns.slice();
        // @ts-ignore
        headers[0] = options.comment + ' ' + headers[0];

        list = [
            headers,
            ...list,
        ]
    }

    return stringify(list, {
        delimiter,
    })

Additional context

# domain    path    name    value   expires
xxx.cc  /   connect.sid xxx Mon, 03-Feb-2025 19:32:17 GMT
xxx.cc  /   connect.sid xxx Mon, 03-Feb-2025 19:32:17 GMT
xxx.cc  /   connect.sid2    xxx Wed, 14-Jun-2017 07:00:00 GMT
xxx.cc  /   connect.sid3    xxx Wed, 31-Dec-1969 23:59:59 GMT
xxx.cc  /   connect.sid xxx Mon, 03-Feb-2025 19:32:17 GMT
xxx.cc  /   connect.sid xxx Mon, 03-Feb-2025 19:32:17 GMT
xxx.cc  /   connect.sid xxx Mon, 03-Feb-2025 19:32:17 GMT
xxx.cc  /   connect.sid xxx Mon, 03-Feb-2025 19:32:17 GMT

Add any other context or screenshots about the feature request here.

wdavidw commented 7 months ago

Good idea, let me know if you are thinking to submit a merge request.

bluelovers commented 7 months ago

i don't know how to make a good pr

wdavidw commented 7 months ago

I can do it. If you wish to give it a try, there are a lot of tutorials on how to fork this repo and propose some changes. I'll mentor you if necessary (in such case, give me access to your fork).