Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to quote empty strings? #84

Open
nrabinowitz opened this issue Jul 27, 2021 · 1 comment
Open

Option to quote empty strings? #84

nrabinowitz opened this issue Jul 27, 2021 · 1 comment

Comments

@nrabinowitz
Copy link

Right now there's no way to distinguish between empty strings and missing data in formatted output.

csvFormatRows([['value', 'null', 'undefined', 'string'], [0,null,undefined,'']]);

I'd like this to return:

value
0,,,""

But instead I get:

value
0,,,
@mbostock
Copy link
Member

This would need a symmetric option with parsing such that an unquoted empty string is mapped to null (or undefined?) whereas a quoted empty string is mapped to the empty string. Specifically in these two places:

return text.slice(j, i);

return eof = true, text.slice(j, N);

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

No branches or pull requests

2 participants