Skip to content

Commit 36fed3c

Browse files
committed
Fixed bug where empty array literals were being printed when no data was given and the keys option was set
1 parent ae91034 commit 36fed3c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/json2csv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ export const Json2Csv = function(options: FullJson2CsvOptions) {
457457
*/
458458
function convert(data: object[]) {
459459
// Single document, not an array
460-
if (utils.isObject(data) && !data.length) {
460+
if (!Array.isArray(data)) {
461461
data = [data]; // Convert to an array of the given document
462462
}
463463

0 commit comments

Comments
 (0)