-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Description
I am not sure if this is expected behavior or a bug, so I am submitting it for further consideration. Any guidance is much appreciated!
Setup
Running node 0.10.26, json-2-csv 0.1.4:
var converter = require('json-2-csv');
var data = [
{
label: 'first',
value: 10
},
{
label: 'second',
value: 0
},
{
label: 'third',
value: 20
}
];
converter.json2csv(data, function (err, csv) {
console.log(csv);
});
Observed
label,value
first,10
second,
third,20
Expected
label,value
first,10
second,0
third,20
Note that the expected output contains a 0
on the line associated with the label second
as provided in the input data.
Cause?
This appears to be caused by a value || ''
check and 0
evaluates to falsy.
Metadata
Metadata
Assignees
Labels
No labels