You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Export missing properties and null values as empty CSV fields instead of the strings "undefined" or "null".
Preserve explicit "undefined" and "null" string values.
Add regression coverage for uneven rows and for null beside the literal string 'null'.
Tests
sh build.sh
npx --yes bun test --dots --preload ./test/bun-setup.js ./test/test-csv-missing-properties.js ./test/test369.js ./test/test176.js — 14 passed.
Manually verified null versus 'null' with default quoting and quote: ''.
The latest full local run had 16 known Windows path handling failures in test107-B.js / test2149.js and 5 external-network failures in test2112.js / test418.js; network failures vary between runs. No CSV regression tests failed.
A null value still comes out as the quoted string "null":
alasql('SELECT * INTO CSV({headers:true, utf8Bom:false}) FROM ?',[[{a: 1,b: null}]]);// '"a";"b"\r\n1;"null"\r\n'
With this change a missing property and a SQL NULL (SELECT NULL AS b, or a NULL stored with INSERT) both export as an empty field, but a JS null, which is what JSON input usually has, does not. It also can't be told apart from the real string 'null'. With quote: '' it prints null.
Checking s == null instead of s === undefined would cover both. A test row with null next to the string 'null' would pin it.
Ran on 576180d with Node 24 and compared with develop 72973ef.
Thanks for catching this. I changed the check to s == null and added a regression test with null beside the literal string 'null'. The new test failed before the change and now passes. I also manually verified both default quoting and quote: ''; the focused suite now has 14 passing tests.
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
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
nullvalues as empty CSV fields instead of the strings"undefined"or"null"."undefined"and"null"string values.nullbeside the literal string'null'.Tests
sh build.shnpx --yes bun test --dots --preload ./test/bun-setup.js ./test/test-csv-missing-properties.js ./test/test369.js ./test/test176.js— 14 passed.nullversus'null'with default quoting andquote: ''.test107-B.js/test2149.jsand 5 external-network failures intest2112.js/test418.js; network failures vary between runs. No CSV regression tests failed.Closes #369
Disclosure: This contribution was prepared with AI assistance (Kimi).