You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
@@ -830,7 +826,7 @@ var Parser = /*#__PURE__*/function (_Transform) {
830
826
pos+=quote.length-1;
831
827
continue;
832
828
}elseif(relax===false){
833
-
varerr=this.__error(newCsvError('CSV_INVALID_CLOSING_QUOTE',['Invalid Closing Quote:',"got \"".concat(String.fromCharCode(nextChr),"\""),"at line ".concat(this.info.lines),'instead of delimiter, record delimiter, trimable character','(if activated) or comment'],this.options,this.__context()));
829
+
varerr=this.__error(newCsvError('CSV_INVALID_CLOSING_QUOTE',['Invalid Closing Quote:',"got \"".concat(String.fromCharCode(nextChr),"\""),"at line ".concat(this.info.lines),'instead of delimiter, record delimiter, trimable character','(if activated) or comment'],this.options,this.__infoField()));
834
830
835
831
if(err!==undefined)returnerr;
836
832
}else{
@@ -843,7 +839,7 @@ var Parser = /*#__PURE__*/function (_Transform) {
843
839
if(this.state.field.length!==0){
844
840
// In relax mode, treat opening quote preceded by chrs as regular
845
841
if(relax===false){
846
-
var_err=this.__error(newCsvError('INVALID_OPENING_QUOTE',['Invalid Opening Quote:',"a quote is found inside a field at line ".concat(this.info.lines)],this.options,this.__context(),{
842
+
var_err=this.__error(newCsvError('INVALID_OPENING_QUOTE',['Invalid Opening Quote:',"a quote is found inside a field at line ".concat(this.info.lines)],this.options,this.__infoField(),{
847
843
field: this.state.field
848
844
}));
849
845
@@ -931,7 +927,7 @@ var Parser = /*#__PURE__*/function (_Transform) {
var_err2=this.__error(newCsvError('CSV_MAX_RECORD_SIZE',['Max Record Size:','record exceed the maximum number of tolerated bytes',"of ".concat(max_record_size),"at line ".concat(this.info.lines)],this.options,this.__context()));
930
+
var_err2=this.__error(newCsvError('CSV_MAX_RECORD_SIZE',['Max Record Size:','record exceed the maximum number of tolerated bytes',"of ".concat(max_record_size),"at line ".concat(this.info.lines)],this.options,this.__infoField()));
935
931
936
932
if(_err2!==undefined)return_err2;
937
933
}
@@ -944,7 +940,7 @@ var Parser = /*#__PURE__*/function (_Transform) {
var_err3=this.__error(newCsvError('CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE',['Invalid Closing Quote:','found non trimable byte after quote',"at line ".concat(this.info.lines)],this.options,this.__context()));
943
+
var_err3=this.__error(newCsvError('CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE',['Invalid Closing Quote:','found non trimable byte after quote',"at line ".concat(this.info.lines)],this.options,this.__infoField()));
948
944
949
945
if(_err3!==undefined)return_err3;
950
946
}
@@ -953,7 +949,7 @@ var Parser = /*#__PURE__*/function (_Transform) {
953
949
if(end===true){
954
950
// Ensure we are not ending in a quoting state
955
951
if(this.state.quoting===true){
956
-
var_err4=this.__error(newCsvError('CSV_QUOTE_NOT_CLOSED',['Quote Not Closed:',"the parsing is finished with an opening quote at line ".concat(this.info.lines)],this.options,this.__context()));
952
+
var_err4=this.__error(newCsvError('CSV_QUOTE_NOT_CLOSED',['Quote Not Closed:',"the parsing is finished with an opening quote at line ".concat(this.info.lines)],this.options,this.__infoField()));
957
953
958
954
if(_err4!==undefined)return_err4;
959
955
}else{
@@ -1023,12 +1019,12 @@ var Parser = /*#__PURE__*/function (_Transform) {
varerr=columns===false ? // Todo: rename CSV_INCONSISTENT_RECORD_LENGTH to
1025
1021
// CSV_RECORD_INCONSISTENT_FIELDS_LENGTH
1026
-
newCsvError('CSV_INCONSISTENT_RECORD_LENGTH',['Invalid Record Length:',"expect ".concat(this.state.expectedRecordLength,","),"got ".concat(recordLength," on line ").concat(this.info.lines)],this.options,this.__context(),{
1022
+
newCsvError('CSV_INCONSISTENT_RECORD_LENGTH',['Invalid Record Length:',"expect ".concat(this.state.expectedRecordLength,","),"got ".concat(recordLength," on line ").concat(this.info.lines)],this.options,this.__infoField(),{
1027
1023
record: record
1028
1024
}) : // Todo: rename CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH to
1029
1025
// CSV_RECORD_INCONSISTENT_COLUMNS
1030
1026
newCsvError('CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH',['Invalid Record Length:',"columns length is ".concat(columns.length,","),// rename columns
1031
-
"got ".concat(recordLength," on line ").concat(this.info.lines)],this.options,this.__context(),{
1027
+
"got ".concat(recordLength," on line ").concat(this.info.lines)],this.options,this.__infoField(),{
1032
1028
record: record
1033
1029
});
1034
1030
@@ -1085,7 +1081,7 @@ var Parser = /*#__PURE__*/function (_Transform) {
1085
1081
},raw===true ? {
1086
1082
raw: this.state.rawBuffer.toString(encoding)
1087
1083
} : {},info===true ? {
1088
-
info: _objectSpread({},this.info)
1084
+
info: this.__infoRecord()
1089
1085
} : {}));
1090
1086
1091
1087
if(_err5){
@@ -1106,7 +1102,7 @@ var Parser = /*#__PURE__*/function (_Transform) {
1106
1102
},raw===true ? {
1107
1103
raw: this.state.rawBuffer.toString(encoding)
1108
1104
} : {},info===true ? {
1109
-
info: _objectSpread({},this.info)
1105
+
info: this.__infoRecord()
1110
1106
} : {}));
1111
1107
1112
1108
if(_err7){
@@ -1128,7 +1124,7 @@ var Parser = /*#__PURE__*/function (_Transform) {
1128
1124
},raw===true ? {
1129
1125
raw: this.state.rawBuffer.toString(encoding)
1130
1126
} : {},info===true ? {
1131
-
info: _objectSpread({},this.info)
1127
+
info: this.__infoRecord()
1132
1128
} : {}));
1133
1129
1134
1130
if(_err9){
@@ -1155,7 +1151,7 @@ var Parser = /*#__PURE__*/function (_Transform) {
1155
1151
varheaders=firstLineToHeaders===undefined ? record : firstLineToHeaders.call(null,record);
1156
1152
1157
1153
if(!Array.isArray(headers)){
1158
-
returnthis.__error(newCsvError('CSV_INVALID_COLUMN_MAPPING',['Invalid Column Mapping:','expect an array from column function,',"got ".concat(JSON.stringify(headers))],this.options,this.__context(),{
1154
+
returnthis.__error(newCsvError('CSV_INVALID_COLUMN_MAPPING',['Invalid Column Mapping:','expect an array from column function,',"got ".concat(JSON.stringify(headers))],this.options,this.__infoField(),{
1159
1155
headers: headers
1160
1156
}));
1161
1157
}
@@ -1195,7 +1191,6 @@ var Parser = /*#__PURE__*/function (_Transform) {
1195
1191
wasQuoting=_this$state3.wasQuoting;// Short circuit for the from_line options
1196
1192
1197
1193
if(enabled===false){
1198
-
/* this.options.columns !== true && */
1199
1194
returnthis.__resetField();
1200
1195
}
1201
1196
@@ -1235,10 +1230,10 @@ var Parser = /*#__PURE__*/function (_Transform) {
1235
1230
varon_record=this.options.on_record;
1236
1231
1237
1232
if(on_record!==undefined){
1238
-
varcontext=this.__context();
1233
+
varinfo=this.__infoRecord();
1239
1234
1240
1235
try{
1241
-
record=on_record.call(null,record,context);
1236
+
record=on_record.call(null,record,info);
1242
1237
}catch(err){
1243
1238
returnerr;
1244
1239
}
@@ -1265,11 +1260,11 @@ var Parser = /*#__PURE__*/function (_Transform) {
0 commit comments