csv-parse
Advanced tools
Comparing version 4.4.6 to 4.4.7
@@ -10,2 +10,7 @@ | ||
## Version 4.4.7 | ||
* travis: remove node.js 8 and add 12 | ||
* destroy: test inside readable event | ||
## Version 4.4.6 | ||
@@ -12,0 +17,0 @@ |
@@ -26,3 +26,3 @@ // Original definitions in https://github.com/DefinitelyTyped/DefinitelyTyped by: David Muller <https://github.com/davidm77> | ||
readonly options: Options; | ||
readonly options: Options | ||
@@ -33,3 +33,3 @@ readonly info: Info; | ||
interface CastingContext { | ||
readonly column?: number | string; | ||
readonly column: number | string; | ||
readonly empty_lines: number; | ||
@@ -124,3 +124,3 @@ readonly header: boolean; | ||
*/ | ||
quote?: string | boolean | Buffer; | ||
quote?: string | boolean | Buffer | null; | ||
/** | ||
@@ -127,0 +127,0 @@ * Generate two properties raw and row where raw is the original CSV row content and row is the parsed array or object. |
@@ -963,5 +963,10 @@ "use strict"; | ||
value: function __cast(field) { | ||
var isColumns = Array.isArray(this.options.columns); // Dont loose time calling cast if the field wont be part of the final record | ||
var _this$options4 = this.options, | ||
columns = _this$options4.columns, | ||
relax_column_count = _this$options4.relax_column_count; | ||
var isColumns = Array.isArray(columns); // Dont loose time calling cast | ||
// because the final record is an object | ||
// and this field can't be associated to a key present in columns | ||
if (isColumns === true && this.options.columns.length <= this.state.record.length) { | ||
if (isColumns === true && relax_column_count && this.options.columns.length <= this.state.record.length) { | ||
return [undefined, undefined]; | ||
@@ -971,5 +976,5 @@ } | ||
var context = { | ||
column: isColumns === true ? this.options.columns[this.state.record.length].name : this.state.record.length, | ||
column: isColumns === true ? columns[this.state.record.length].name : this.state.record.length, | ||
empty_lines: this.info.empty_lines, | ||
header: this.options.columns === true, | ||
header: columns === true, | ||
index: this.state.record.length, | ||
@@ -1028,6 +1033,6 @@ invalid_field_length: this.info.invalid_field_length, | ||
var _this$options4 = this.options, | ||
comment = _this$options4.comment, | ||
delimiter = _this$options4.delimiter, | ||
escape = _this$options4.escape; | ||
var _this$options5 = this.options, | ||
comment = _this$options5.comment, | ||
delimiter = _this$options5.delimiter, | ||
escape = _this$options5.escape; | ||
var _this$state4 = this.state, | ||
@@ -1034,0 +1039,0 @@ quoting = _this$state4.quoting, |
@@ -26,3 +26,3 @@ // Original definitions in https://github.com/DefinitelyTyped/DefinitelyTyped by: David Muller <https://github.com/davidm77> | ||
readonly options: Options; | ||
readonly options: Options | ||
@@ -33,3 +33,3 @@ readonly info: Info; | ||
interface CastingContext { | ||
readonly column?: number | string; | ||
readonly column: number | string; | ||
readonly empty_lines: number; | ||
@@ -124,3 +124,3 @@ readonly header: boolean; | ||
*/ | ||
quote?: string | boolean | Buffer; | ||
quote?: string | boolean | Buffer | null; | ||
/** | ||
@@ -127,0 +127,0 @@ * Generate two properties raw and row where raw is the original CSV row content and row is the parsed array or object. |
@@ -726,5 +726,8 @@ | ||
__cast(field){ | ||
const isColumns = Array.isArray(this.options.columns) | ||
// Dont loose time calling cast if the field wont be part of the final record | ||
if( isColumns === true && this.options.columns.length <= this.state.record.length ){ | ||
const {columns, relax_column_count} = this.options | ||
const isColumns = Array.isArray(columns) | ||
// Dont loose time calling cast | ||
// because the final record is an object | ||
// and this field can't be associated to a key present in columns | ||
if( isColumns === true && relax_column_count && this.options.columns.length <= this.state.record.length ){ | ||
return [undefined, undefined] | ||
@@ -734,6 +737,6 @@ } | ||
column: isColumns === true ? | ||
this.options.columns[this.state.record.length].name : | ||
columns[this.state.record.length].name : | ||
this.state.record.length, | ||
empty_lines: this.info.empty_lines, | ||
header: this.options.columns === true, | ||
header: columns === true, | ||
index: this.state.record.length, | ||
@@ -740,0 +743,0 @@ invalid_field_length: this.info.invalid_field_length, |
{ | ||
"version": "4.4.6", | ||
"version": "4.4.7", | ||
"name": "csv-parse", | ||
@@ -79,3 +79,3 @@ "description": "CSV parsing implementing the Node.js `stream.Transform` API", | ||
"pretest": "cd lib && babel *.js -d es5 && cd ..", | ||
"test": "mocha test/**/*.{coffee,ts}" | ||
"test": "TS_NODE_COMPILER_OPTIONS='{\"strictNullChecks\":true}' mocha test/**/*.{coffee,ts}" | ||
}, | ||
@@ -82,0 +82,0 @@ "types": [ |
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
115594
2412