@dra2020/baseclient 1.0.136 → 1.0.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/baseclient.js +49 -1
- package/dist/baseclient.js.map +1 -1
- package/dist/csv/all.d.ts +1 -0
- package/dist/csv/csvparseline.d.ts +1 -0
- package/lib/csv/all.ts +1 -0
- package/lib/csv/csvparseline.ts +35 -0
- package/lib/filterexpr/filterexpr.ts +8 -1
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -860,6 +860,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
860
860
|
};
|
|
861
861
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
862
862
|
__exportStar(__webpack_require__(/*! ./csv */ "./lib/csv/csv.ts"), exports);
|
|
863
|
+
__exportStar(__webpack_require__(/*! ./csvparseline */ "./lib/csv/csvparseline.ts"), exports);
|
|
863
864
|
|
|
864
865
|
|
|
865
866
|
/***/ }),
|
|
@@ -1025,6 +1026,48 @@ class ParseOne {
|
|
|
1025
1026
|
exports.ParseOne = ParseOne;
|
|
1026
1027
|
|
|
1027
1028
|
|
|
1029
|
+
/***/ }),
|
|
1030
|
+
|
|
1031
|
+
/***/ "./lib/csv/csvparseline.ts":
|
|
1032
|
+
/*!*********************************!*\
|
|
1033
|
+
!*** ./lib/csv/csvparseline.ts ***!
|
|
1034
|
+
\*********************************/
|
|
1035
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1039
|
+
exports.csvParseLine = void 0;
|
|
1040
|
+
const reField = /^\s*("([^"]*(?:""[^"]*)*)"|[^,|]*)\s*[|,]?/;
|
|
1041
|
+
const reQuote = /^"/;
|
|
1042
|
+
const reAddOne = /[|,]$/;
|
|
1043
|
+
function csvParseLine(s) {
|
|
1044
|
+
let fields = [];
|
|
1045
|
+
s = s.trim();
|
|
1046
|
+
let addOne = reAddOne.test(s);
|
|
1047
|
+
while (s) {
|
|
1048
|
+
const match = reField.exec(s);
|
|
1049
|
+
if (match) {
|
|
1050
|
+
let field = match[1];
|
|
1051
|
+
if (reQuote.test(field)) {
|
|
1052
|
+
// if quoted string, convert quoted double-quotes to single quote
|
|
1053
|
+
field = field.slice(1, -1).replace(/""/g, '"');
|
|
1054
|
+
// and remove optional start and end double quote
|
|
1055
|
+
field = field.replace(/^["]?/, '').replace(/["]?$/, '');
|
|
1056
|
+
}
|
|
1057
|
+
fields.push(field);
|
|
1058
|
+
s = s.substring(match[0].length);
|
|
1059
|
+
}
|
|
1060
|
+
else
|
|
1061
|
+
s = null;
|
|
1062
|
+
}
|
|
1063
|
+
// Handle trailing separator
|
|
1064
|
+
if (addOne)
|
|
1065
|
+
fields.push('');
|
|
1066
|
+
return fields;
|
|
1067
|
+
}
|
|
1068
|
+
exports.csvParseLine = csvParseLine;
|
|
1069
|
+
|
|
1070
|
+
|
|
1028
1071
|
/***/ }),
|
|
1029
1072
|
|
|
1030
1073
|
/***/ "./lib/dataflow/all.ts":
|
|
@@ -1480,6 +1523,11 @@ const UpperR = 82;
|
|
|
1480
1523
|
function isWhite(c) {
|
|
1481
1524
|
return c === Space || c === Newline || c === Tab || c == CR;
|
|
1482
1525
|
}
|
|
1526
|
+
function toString(a) {
|
|
1527
|
+
if (typeof a === 'object' && a && typeof a.value === 'string')
|
|
1528
|
+
return a.value;
|
|
1529
|
+
return String(a);
|
|
1530
|
+
}
|
|
1483
1531
|
var TokType;
|
|
1484
1532
|
(function (TokType) {
|
|
1485
1533
|
TokType[TokType["Text"] = 0] = "Text";
|
|
@@ -1952,7 +2000,7 @@ class FilterExpr {
|
|
|
1952
2000
|
case TokType.Text:
|
|
1953
2001
|
for (let p in o)
|
|
1954
2002
|
if (o.hasOwnProperty(p) && (prop == null || p.toLowerCase() === prop)) {
|
|
1955
|
-
let s =
|
|
2003
|
+
let s = toString(o[p]);
|
|
1956
2004
|
if (s) {
|
|
1957
2005
|
let t = types ? types[p] : undefined;
|
|
1958
2006
|
if (t === 'skip')
|