mholt/PapaParse — pull request #70 by jscheid (2014-07-23 20:04:49+00:00)
Title: Add support for per-column quoting in Papa.unparse

This is something I need in a production setting. It might seem a funny requirement, but sometimes the other end expects only certain columns in a CSV file to be force-quoted.

PapaParse wouldn't be the first CSV generator to support this feature, see for example http://supercsv.sourceforge.net/apidocs/org/supercsv/quote/ColumnQuoteMode.html#ColumnQuoteMode-boolean:A-

With this change, the `quotes` property in the `unparse` configuration can be a boolean as before, or an array of values whose truthiness determines whether or not the respective column gets force-quoted.

I was planning to add a test case to go along with it, but it looks like testing of the `unparse` function isn't yet supported by your test suite and so I didn't bother.

I didn't go overboard with checking the `quotes` configuration value when it's an array: its length isn't checked to match the number of columns, and there is no attempt to make sure it only contains boolean values. I think it's fine as-is, but feel free to make it more strict.