Comparing version 3.6.0 to 3.6.1
@@ -0,1 +1,5 @@ | ||
## 3.6.1 / 2016-07-12 | ||
* Fix auto-fields returning all avilable fields, even if not available on the first object, see #104 | ||
## 3.6.0 / 2016-07-07 | ||
@@ -2,0 +6,0 @@ |
@@ -6,2 +6,4 @@ /** | ||
var lodashGet = require('lodash.get'); | ||
var lodashFlatten = require('lodash.flatten'); | ||
var lodashUniq = require('lodash.uniq'); | ||
var flatten = require('flat'); | ||
@@ -21,4 +23,4 @@ | ||
var hasCallback = typeof callback === 'function'; | ||
var err; | ||
var err; | ||
try { | ||
@@ -35,4 +37,6 @@ checkParams(params); | ||
} | ||
var titles = createColumnTitles(params); | ||
var csv = createColumnContent(params, titles); | ||
if (hasCallback) { | ||
@@ -73,5 +77,14 @@ return process.nextTick(function () { | ||
} | ||
params.fields = params.fields || Object.keys(params.data[0]); | ||
if (!params.fields) { | ||
var dataFields = params.data.map(function (item) { | ||
return Object.keys(item); | ||
}); | ||
dataFields = lodashFlatten(dataFields); | ||
params.fields = lodashUniq(dataFields); | ||
debugger; | ||
} | ||
//#check fieldNames | ||
@@ -78,0 +91,0 @@ if (params.fieldNames && params.fieldNames.length !== params.fields.length) { |
{ | ||
"name": "json2csv", | ||
"preferGlobal": "true", | ||
"version": "3.6.0", | ||
"version": "3.6.1", | ||
"description": "Convert JSON to CSV", | ||
@@ -37,3 +37,5 @@ "keywords": [ | ||
"flat": "^2.0.0", | ||
"lodash.flatten": "^4.2.0", | ||
"lodash.get": "^4.3.0", | ||
"lodash.uniq": "^4.3.0", | ||
"path-is-absolute": "^1.0.0" | ||
@@ -40,0 +42,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
28362
369
8
+ Addedlodash.flatten@^4.2.0
+ Addedlodash.uniq@^4.3.0
+ Addedlodash.flatten@4.4.0(transitive)
+ Addedlodash.uniq@4.5.0(transitive)