Option quoted_empty

Table of Contents

Quote empty strings and overrides quoted_string on empty strings when defined. The behavior of this option is the opposite of the quoted 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.


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

const stringify = require('../lib')
const assert = require('assert')

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