Repository navigation
fix(dsv): preserve literal proto columns - #112
Open
awais-ur-rehman wants to merge 1 commit into
Open
awais-ur-rehman wants to merge 1 commit into
awais-ur-rehman wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Parsing
__proto__,name\nvalue,testcurrently drops the first column: the generated row object's"__proto__": valueentry 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.