jsonexport
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -82,9 +82,25 @@ /** | ||
} | ||
parseResult.forEach(function (result) { | ||
//Initialize the array with empty strings to handle 'unpopular' headers | ||
var row = Array(headers.length).join(".").split("."); | ||
var resultRows = [Array(headers.length).join(".").split(".")]; | ||
result.forEach(function(element){ | ||
row[headers.indexOf(element.item)] = element.value; | ||
var placed = false; | ||
resultRows.forEach(function (row) { | ||
if(!placed && row[headers.indexOf(element.item)] == ''){ | ||
row[headers.indexOf(element.item)] = element.value; | ||
placed = true; | ||
} | ||
}); | ||
if(!placed){ | ||
var newRow = Array(headers.length).join(".").split("."); | ||
newRow[headers.indexOf(element.item)] = element.value; | ||
resultRows.push(newRow); | ||
} | ||
}); | ||
fileRows.push(row.join(options.rowDelimiter)); | ||
resultRows.forEach(function (row) { | ||
fileRows.push(row.join(options.rowDelimiter)); | ||
}); | ||
}); | ||
@@ -259,2 +275,3 @@ //Merge all rows in a single output with the correct End of Line string | ||
var resultCheckType = checkType(element); | ||
//Append to results | ||
@@ -261,0 +278,0 @@ result = result.concat(resultCheckType); |
{ | ||
"name": "jsonexport", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Makes easy to convert JSON to CSV", | ||
@@ -5,0 +5,0 @@ "main": "./lib", |
# jsonexport | ||
This module makes easy to convert JSON to CSV and its very customizable. | ||
Changelog | ||
---------------------- | ||
v1.05 - Create new lines in the CSV file to handle JSON objects with arrays<br> | ||
# Usage | ||
@@ -5,0 +9,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28848
336
243