json-2-csv
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "json-2-csv", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"homepage": "https://github.com/mrodrig/json-2-csv", | ||
@@ -5,0 +5,0 @@ "moduleType": [ |
@@ -25,2 +25,4 @@ 'use strict'; | ||
}); | ||
var uniqueKeys = []; | ||
@@ -52,18 +54,10 @@ // If the user wants to check for the same schema: | ||
var result = _.flatten(keys[0]); | ||
if (options.SORT_HEADER) { | ||
result.sort(); | ||
} | ||
return Promise.resolve(result); | ||
uniqueKeys = _.flatten(keys[0]); | ||
} else { | ||
// Otherwise, we do not care if the schemas are different, so we should merge them via union: | ||
_.each(keys, function (keyList) { | ||
uniqueKeys = _.union(uniqueKeys, _.flatten(keyList)); | ||
}); | ||
} | ||
var uniqueKeys = []; | ||
// Otherwise, we do not care if the schemas are different, so we should merge them via union: | ||
_.each(keys, function (keyList) { | ||
uniqueKeys = _.union(uniqueKeys, _.flatten(keyList)); | ||
}); | ||
if (options.SORT_HEADER) { | ||
@@ -70,0 +64,0 @@ uniqueKeys.sort(); |
@@ -5,3 +5,3 @@ { | ||
"description": "A JSON to CSV and CSV to JSON converter that natively supports sub-documents and auto-generates the CSV heading.", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -39,2 +39,3 @@ # Convert JSON to CSV or CSV to JSON | ||
* `PREPEND_HEADER` - Boolean - Should the auto-generated header be prepended as the first line in the CSV? Default: `true` | ||
* `SORT_HEADER` - Boolean - Should the header keys be sorted in alphabetical order? Default: `false` | ||
* `KEYS` - Array - Specify the keys (as strings) that should be converted. Default: `null` | ||
@@ -150,6 +151,6 @@ * If you have a nested object (ie. {info : {name: 'Mike'}}), then set options.KEYS to ['info.name'] | ||
``` | ||
Statements : 96.88% ( 155/160 ) | ||
Branches : 93.55% ( 116/124 ) | ||
Functions : 100% ( 31/31 ) | ||
Lines : 97.99% ( 146/149 ) | ||
Statements : 96.69% ( 175/181 ) | ||
Branches : 93.48% ( 129/138 ) | ||
Functions : 100% ( 33/33 ) | ||
Lines : 97.63% ( 165/169 ) | ||
``` | ||
@@ -156,0 +157,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
157252
20
871
230