We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1349a94 commit 0d8534eCopy full SHA for 0d8534e
lib/JSON2CSVParser.js
@@ -40,7 +40,7 @@ class JSON2CSVParser extends JSON2CSVBase {
40
preprocessData(data) {
41
const processedData = Array.isArray(data) ? data : [data];
42
43
- if (processedData.length === 0 || typeof processedData[0] !== 'object') {
+ if (!this.opts.fields && processedData.length === 0 || typeof processedData[0] !== 'object') {
44
throw new Error('Data should not be empty or the "fields" option should be included');
45
}
46
@@ -63,4 +63,4 @@ class JSON2CSVParser extends JSON2CSVBase {
63
64
65
66
-module.exports = JSON2CSVParser;
+module.exports = JSON2CSVParser;
0 commit comments