Comparing version 2.0.2 to 2.0.3
@@ -75,2 +75,20 @@ var es = require('event-stream'); | ||
var val = self.getValue(data, field.name) | ||
// vinicioslc support to OR || operator allowing multiples names to the same column | ||
// the code will use the last non null and non empty value | ||
if (field.name.includes('||')) { | ||
// by default column is empty | ||
val = '' | ||
let fields = field.name.split('||'); | ||
// for each alternative | ||
fields.forEach(field => { | ||
// get value and associate | ||
let fieldVal = self.getValue(data, field) | ||
// remove whitespaces and check if non null before assign | ||
if (typeof val !== 'undefined' && val !== null && fieldVal.trim().length > 0 && fieldVal.trim() != "") { | ||
val = fieldVal | ||
} | ||
//do this for every field | ||
}); | ||
} | ||
if (field.filter) { | ||
@@ -77,0 +95,0 @@ val = field.filter(val) |
{ | ||
"name": "json-csv", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Export a richly structured, JSON array to CSV", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/IWSLLC/json-csv", |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
29219
23
334
0