Skip to content

fix(dsv): preserve literal proto columns - #112

Open
awais-ur-rehman wants to merge 1 commit into
d3:mainfrom
awais-ur-rehman:feat/preserve-proto-column-names
Open

awais-ur-rehman wants to merge 1 commit into
d3:mainfrom
awais-ur-rehman:feat/preserve-proto-column-names

Conversation

@awais-ur-rehman

@awais-ur-rehman awais-ur-rehman commented Oct 31, 2026 •

Copy link
Copy Markdown

Summary

Parsing __proto__,name\nvalue,test currently drops the first column: the generated row object's "__proto__": value entry uses special prototype-setter syntax instead of creating a property. Repeated __proto__ headers also throw a SyntaxError when the converter is compiled. Generate computed property keys so this column becomes an ordinary own property and duplicate names retain the last value, like other columns.

Tests cover comma, tab and custom delimiters, row conversion callbacks, missing cells, duplicate names, ordinary prototype-member/empty names, unchanged object prototypes and parse/format round-trips.

Testing

Validation on Node.js 24.19.0: npm test (148 passing plus ESLint), rollup -c (both UMD bundles), git diff --check, and smoke checks against both generated bundles for own-column preservation, formatting round-trip and duplicate-header handling. All 12 new regressions failed before the fix. The generated computed-property syntax is supported by the project's Node.js >=12 requirement; older browser runtimes were not tested.

Assisted by OpenAI Codex for reproduction, implementation and test execution.

Breaking Changes

None.

Manual verification: Parse a CSV with a __proto__ column and format it again; the property should be own/enumerable, and duplicate headers should keep the last value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant