Closed alexstrat closed 2 years ago
Describe the bug
Even if used with header: true and columns options, csv-stringify/sync does not output headers when input is an empty array.
header: true
columns
csv-stringify/sync
The stream or callback API does.
To Reproduce
const { stringify } = require('csv-stringify/sync') stringify([], { header: true, columns: ['foo', 'bar']}) // ❌ returns '' // expected 'foo,bar' const { stringify } = require('csv-stringify') stringify([], { header: true, columns: ['foo', 'bar']}, (e, content) => console.log(content)) // ✅ logs 'foo,bar'
Describe the bug
Even if used with
header: true
andcolumns
options,csv-stringify/sync
does not output headers when input is an empty array.The stream or callback API does.
To Reproduce