node-csv
node-csv copied to clipboard
Return value in cast example
When I used the "cast" example as-is, I got the error message:
CsvError: Option columns missing name: property "name" is required at position 0 when column is an object literal
at normalize_columns_array (/Users/apickler/rocket/rockethomes/tmp/mls_csv_compare/node_modules/csv-parse/dist/cjs/index.cjs:36:15)
at Object.__firstLineToColumns (/Users/apickler/rocket/rockethomes/tmp/mls_csv_compare/node_modules/csv-parse/dist/cjs/index.cjs:1067:35)
at Object.__onRecord (/Users/apickler/rocket/rockethomes/tmp/mls_csv_compare/node_modules/csv-parse/dist/cjs/index.cjs:943:21)
at Object.parse (/Users/apickler/rocket/rockethomes/tmp/mls_csv_compare/node_modules/csv-parse/dist/cjs/index.cjs:835:40)
at Parser._transform (/Users/apickler/rocket/rockethomes/tmp/mls_csv_compare/node_modules/csv-parse/dist/cjs/index.cjs:1331:26)
It would seem to me (and what works for me locally) is that when you don't need to cast a particular column, that you just want to return the unmodified value?
- Could you add a unit test (you could submit it in js if not confortalbe with coffee) to your merge request ?
- "When I used the "cast" example as-is", please share an example (or the unit test will be enough to understand how to reproduce)
I enriched the cast documentation page with a new usage sample that preserve a value as is. Hopefully it will answer your concern. Otherwise feel free to open a new issue.