Option quoted

Table of Contents

Quote all the non-empty fields even when there is no character requiring quotes. The behavior of this option is the opposite of the quoted_empty option and can be used conjointly to quote every fields.

Note, several options are available to control when to quote fields under certain conditions. Make sure to review the alternatives.

Example using "quote"

In the quoted example, every field evaluated as empty is not quoted. It includes an empty string and values of false, null and undefined.

const parse = require('csv-parse')
const assert = require('assert')

stringify([
  ['1', ''],
  [false, '2'],
  ['3', null],
  [undefined, '4']
], {
  quoted: true
}, function(err, records){
  assert.equal(records, '"1",\n,"2"\n"3",\n,"4"\n')
})