wdavidw/node-csv-stringify — pull request #7 by kevinoid (2014-07-04 02:09:07+00:00)
Title: Support additional quoting options for fields based on data type

For writing CSV files which are consumed by applications that distinguish data types for fields based on how the fields are quoted, it would be great if node-csv-stringify supported some additional options to preserve this information. This pull request adds two such options:

In order to support CSV processors which distinguish between string and non-string values, add the `quotedString` option which unconditionally quotes all string values. This option can be used with the `quoted` option to quote empty string values, but it does not override the `quoted` option (as I can not currently think of a use case where quoting everything but strings would be desirable).

In order to support CSV processors which distinguish between missing/unspecified values and empty strings (i.e. null vs empty string), add the `quotedEmpty` option to specify whether empty values are quoted. This option overrides quoted and `quotedString` to allow users to allow quoting only empty values (to avoid the overhead of quoting all strings while still distinguishing empty from missing values) and to avoid quoting empty strings when they should be treated as missing by the CSV consumer.

I hope you find it useful.

Kevin