jsonexport
Advanced tools
Comparing version 2.0.8 to 2.0.9
@@ -14,2 +14,3 @@ /* jshint node:true */ | ||
this._hasHeaders = false; | ||
this._lastError = null; | ||
} | ||
@@ -20,4 +21,4 @@ | ||
self._extra = self._extra || ""; | ||
// Memory limit | ||
if (self._extra > chunk.toString().length * 3) return null; | ||
// Memory limit | ||
if (self._extra.length > chunk.toString().length * 3) return null; | ||
// Remove starting comma | ||
@@ -42,4 +43,4 @@ if (self._extra.charAt(0) == ',') self._extra = self._extra.substr(1); | ||
// Append extra data to chunk data | ||
chunk = this._mergeChunk(chunk); | ||
if (!chunk) return done(new Error("Invalid JSON")); | ||
chunk = this._mergeChunk(chunk); | ||
if (!chunk) return done(this._lastError); | ||
// Split chunk in objects | ||
@@ -52,2 +53,3 @@ let parts = chunk.split('}'); | ||
} catch (ex) { | ||
this._lastError = ex; | ||
let extraChunk = parts.pop(); | ||
@@ -57,3 +59,3 @@ self._extra = extraChunk + (self._extra || ""); | ||
} | ||
} | ||
} | ||
if (!json) return done(); | ||
@@ -60,0 +62,0 @@ this._parser.parse(json, (err, csvChunk) => { |
@@ -9,2 +9,6 @@ /* jshint node:true */ | ||
this._options = options; | ||
this._options.handleString = this._options.handleString || this._handleString; | ||
this._options.handleNumber = this._options.handleNumber || this._handleNumber; | ||
this._options.handleBoolean = this._options.handleBoolean || this._handleBoolean; | ||
this._options.handleDate = this._options.handleDate || this._handleDate; | ||
} | ||
@@ -31,3 +35,3 @@ | ||
item: item, | ||
value: (this._options.handleString || this._handleString)(element, item), | ||
value: this._options.handleString(element, item), | ||
}]; | ||
@@ -39,3 +43,3 @@ } | ||
item: item, | ||
value: (this._options.handleNumber || this._handleNumber)(element, item), | ||
value: this._options.handleNumber(element, item), | ||
}]; | ||
@@ -47,3 +51,3 @@ } | ||
item: item, | ||
value: (this._options.handleBoolean || this._handleBoolean).bind(this)(element, item), | ||
value: this._options.handleBoolean.bind(this)(element, item), | ||
}]; | ||
@@ -55,3 +59,3 @@ } | ||
item: item, | ||
value: (this._options.handleDate || this._handleDate)(element, item), | ||
value: this._options.handleDate(element, item), | ||
}]; | ||
@@ -58,0 +62,0 @@ } |
{ | ||
"name": "jsonexport", | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"description": "Makes easy to convert JSON to CSV", | ||
@@ -5,0 +5,0 @@ "main": "./lib", |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
1
62719
23
1373
1