adaltas / adaltas/node-csv

support headers as comment

Open
#419 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
4.3k
Forks
299
Avg merge
16h 19m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the stringify entry point and inspect how options and header rows are handled. Confirm the intended headers_as_comment option and comment prefix against the CSV example; done means serialized output has the header row prefixed as a comment without changing normal output, with tests covering it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.