@datapos/datapos-tool-csv-parse 0.0.39 → 0.0.41
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/datapos-tool-csv-parse.es.js +256 -254
- package/dist/types/src/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var ie = typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {}, P = [], F = [], Qt = typeof Uint8Array < "u" ? Uint8Array : Array, $e = !1;
|
|
2
|
-
function
|
|
2
|
+
function lt() {
|
|
3
3
|
$e = !0;
|
|
4
4
|
for (var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", e = 0, r = t.length; e < r; ++e)
|
|
5
5
|
P[e] = t[e], F[t.charCodeAt(e)] = e;
|
|
6
6
|
F[45] = 62, F[95] = 63;
|
|
7
7
|
}
|
|
8
8
|
function Gt(t) {
|
|
9
|
-
$e ||
|
|
9
|
+
$e || lt();
|
|
10
10
|
var e, r, n, i, o, s, f = t.length;
|
|
11
11
|
if (f % 4 > 0)
|
|
12
12
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
13
13
|
o = t[f - 2] === "=" ? 2 : t[f - 1] === "=" ? 1 : 0, s = new Qt(f * 3 / 4 - o), n = o > 0 ? f - 4 : f;
|
|
14
|
-
var
|
|
14
|
+
var u = 0;
|
|
15
15
|
for (e = 0, r = 0; e < n; e += 4, r += 3)
|
|
16
|
-
i = F[t.charCodeAt(e)] << 18 | F[t.charCodeAt(e + 1)] << 12 | F[t.charCodeAt(e + 2)] << 6 | F[t.charCodeAt(e + 3)], s[
|
|
17
|
-
return o === 2 ? (i = F[t.charCodeAt(e)] << 2 | F[t.charCodeAt(e + 1)] >> 4, s[
|
|
16
|
+
i = F[t.charCodeAt(e)] << 18 | F[t.charCodeAt(e + 1)] << 12 | F[t.charCodeAt(e + 2)] << 6 | F[t.charCodeAt(e + 3)], s[u++] = i >> 16 & 255, s[u++] = i >> 8 & 255, s[u++] = i & 255;
|
|
17
|
+
return o === 2 ? (i = F[t.charCodeAt(e)] << 2 | F[t.charCodeAt(e + 1)] >> 4, s[u++] = i & 255) : o === 1 && (i = F[t.charCodeAt(e)] << 10 | F[t.charCodeAt(e + 1)] << 4 | F[t.charCodeAt(e + 2)] >> 2, s[u++] = i >> 8 & 255, s[u++] = i & 255), s;
|
|
18
18
|
}
|
|
19
19
|
function Zt(t) {
|
|
20
20
|
return P[t >> 18 & 63] + P[t >> 12 & 63] + P[t >> 6 & 63] + P[t & 63];
|
|
@@ -25,33 +25,33 @@ function Xt(t, e, r) {
|
|
|
25
25
|
return i.join("");
|
|
26
26
|
}
|
|
27
27
|
function Qe(t) {
|
|
28
|
-
$e ||
|
|
29
|
-
for (var e, r = t.length, n = r % 3, i = "", o = [], s = 16383, f = 0,
|
|
30
|
-
o.push(Xt(t, f, f + s >
|
|
28
|
+
$e || lt();
|
|
29
|
+
for (var e, r = t.length, n = r % 3, i = "", o = [], s = 16383, f = 0, u = r - n; f < u; f += s)
|
|
30
|
+
o.push(Xt(t, f, f + s > u ? u : f + s));
|
|
31
31
|
return n === 1 ? (e = t[r - 1], i += P[e >> 2], i += P[e << 4 & 63], i += "==") : n === 2 && (e = (t[r - 2] << 8) + t[r - 1], i += P[e >> 10], i += P[e >> 4 & 63], i += P[e << 2 & 63], i += "="), o.push(i), o.join("");
|
|
32
32
|
}
|
|
33
33
|
function ve(t, e, r, n, i) {
|
|
34
|
-
var o, s, f = i * 8 - n - 1,
|
|
35
|
-
for (c +=
|
|
34
|
+
var o, s, f = i * 8 - n - 1, u = (1 << f) - 1, l = u >> 1, h = -7, c = r ? i - 1 : 0, g = r ? -1 : 1, y = t[e + c];
|
|
35
|
+
for (c += g, o = y & (1 << -h) - 1, y >>= -h, h += f; h > 0; o = o * 256 + t[e + c], c += g, h -= 8)
|
|
36
36
|
;
|
|
37
|
-
for (s = o & (1 << -h) - 1, o >>= -h, h += n; h > 0; s = s * 256 + t[e + c], c +=
|
|
37
|
+
for (s = o & (1 << -h) - 1, o >>= -h, h += n; h > 0; s = s * 256 + t[e + c], c += g, h -= 8)
|
|
38
38
|
;
|
|
39
39
|
if (o === 0)
|
|
40
|
-
o = 1 -
|
|
40
|
+
o = 1 - l;
|
|
41
41
|
else {
|
|
42
|
-
if (o ===
|
|
43
|
-
return s ? NaN : (
|
|
44
|
-
s = s + Math.pow(2, n), o = o -
|
|
42
|
+
if (o === u)
|
|
43
|
+
return s ? NaN : (y ? -1 : 1) * (1 / 0);
|
|
44
|
+
s = s + Math.pow(2, n), o = o - l;
|
|
45
45
|
}
|
|
46
|
-
return (
|
|
46
|
+
return (y ? -1 : 1) * s * Math.pow(2, o - n);
|
|
47
47
|
}
|
|
48
48
|
function ht(t, e, r, n, i, o) {
|
|
49
|
-
var s, f,
|
|
50
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (
|
|
49
|
+
var s, f, u, l = o * 8 - i - 1, h = (1 << l) - 1, c = h >> 1, g = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = n ? 0 : o - 1, O = n ? 1 : -1, E = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
50
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (u = Math.pow(2, -s)) < 1 && (s--, u *= 2), s + c >= 1 ? e += g / u : e += g * Math.pow(2, 1 - c), e * u >= 2 && (s++, u /= 2), s + c >= h ? (f = 0, s = h) : s + c >= 1 ? (f = (e * u - 1) * Math.pow(2, i), s = s + c) : (f = e * Math.pow(2, c - 1) * Math.pow(2, i), s = 0)); i >= 8; t[r + y] = f & 255, y += O, f /= 256, i -= 8)
|
|
51
51
|
;
|
|
52
|
-
for (s = s << i | f,
|
|
52
|
+
for (s = s << i | f, l += i; l > 0; t[r + y] = s & 255, y += O, s /= 256, l -= 8)
|
|
53
53
|
;
|
|
54
|
-
t[r +
|
|
54
|
+
t[r + y - O] |= E * 128;
|
|
55
55
|
}
|
|
56
56
|
var Kt = {}.toString, ct = Array.isArray || function(t) {
|
|
57
57
|
return Kt.call(t) == "[object Array]";
|
|
@@ -320,9 +320,9 @@ a.prototype.compare = function(e, r, n, i, o) {
|
|
|
320
320
|
if (r >= n)
|
|
321
321
|
return 1;
|
|
322
322
|
if (r >>>= 0, n >>>= 0, i >>>= 0, o >>>= 0, this === e) return 0;
|
|
323
|
-
for (var s = o - i, f = n - r,
|
|
324
|
-
if (
|
|
325
|
-
s =
|
|
323
|
+
for (var s = o - i, f = n - r, u = Math.min(s, f), l = this.slice(i, o), h = e.slice(r, n), c = 0; c < u; ++c)
|
|
324
|
+
if (l[c] !== h[c]) {
|
|
325
|
+
s = l[c], f = h[c];
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
328
|
return s < f ? -1 : f < s ? 1 : 0;
|
|
@@ -348,25 +348,25 @@ function Ge(t, e, r, n, i) {
|
|
|
348
348
|
return -1;
|
|
349
349
|
o = 2, s /= 2, f /= 2, r /= 2;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
return o === 1 ?
|
|
351
|
+
function u(y, O) {
|
|
352
|
+
return o === 1 ? y[O] : y.readUInt16BE(O * o);
|
|
353
353
|
}
|
|
354
|
-
var
|
|
354
|
+
var l;
|
|
355
355
|
if (i) {
|
|
356
356
|
var h = -1;
|
|
357
|
-
for (
|
|
358
|
-
if (
|
|
359
|
-
if (h === -1 && (h =
|
|
357
|
+
for (l = r; l < s; l++)
|
|
358
|
+
if (u(t, l) === u(e, h === -1 ? 0 : l - h)) {
|
|
359
|
+
if (h === -1 && (h = l), l - h + 1 === f) return h * o;
|
|
360
360
|
} else
|
|
361
|
-
h !== -1 && (
|
|
361
|
+
h !== -1 && (l -= l - h), h = -1;
|
|
362
362
|
} else
|
|
363
|
-
for (r + f > s && (r = s - f),
|
|
364
|
-
for (var c = !0,
|
|
365
|
-
if (
|
|
363
|
+
for (r + f > s && (r = s - f), l = r; l >= 0; l--) {
|
|
364
|
+
for (var c = !0, g = 0; g < f; g++)
|
|
365
|
+
if (u(t, l + g) !== u(e, g)) {
|
|
366
366
|
c = !1;
|
|
367
367
|
break;
|
|
368
368
|
}
|
|
369
|
-
if (c) return
|
|
369
|
+
if (c) return l;
|
|
370
370
|
}
|
|
371
371
|
return -1;
|
|
372
372
|
}
|
|
@@ -402,10 +402,10 @@ function _t(t, e, r, n) {
|
|
|
402
402
|
function ar(t, e, r, n) {
|
|
403
403
|
return _t(t, e, r, n);
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function ur(t, e, r, n) {
|
|
406
406
|
return xe(Et(e), t, r, n);
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function lr(t, e, r, n) {
|
|
409
409
|
return xe(Er(e, t.length - r), t, r, n);
|
|
410
410
|
}
|
|
411
411
|
a.prototype.write = function(e, r, n, i) {
|
|
@@ -436,12 +436,12 @@ a.prototype.write = function(e, r, n, i) {
|
|
|
436
436
|
case "binary":
|
|
437
437
|
return ar(this, e, r, n);
|
|
438
438
|
case "base64":
|
|
439
|
-
return
|
|
439
|
+
return ur(this, e, r, n);
|
|
440
440
|
case "ucs2":
|
|
441
441
|
case "ucs-2":
|
|
442
442
|
case "utf16le":
|
|
443
443
|
case "utf-16le":
|
|
444
|
-
return
|
|
444
|
+
return lr(this, e, r, n);
|
|
445
445
|
default:
|
|
446
446
|
if (s) throw new TypeError("Unknown encoding: " + i);
|
|
447
447
|
i = ("" + i).toLowerCase(), s = !0;
|
|
@@ -461,19 +461,19 @@ function wt(t, e, r) {
|
|
|
461
461
|
for (var n = [], i = e; i < r; ) {
|
|
462
462
|
var o = t[i], s = null, f = o > 239 ? 4 : o > 223 ? 3 : o > 191 ? 2 : 1;
|
|
463
463
|
if (i + f <= r) {
|
|
464
|
-
var
|
|
464
|
+
var u, l, h, c;
|
|
465
465
|
switch (f) {
|
|
466
466
|
case 1:
|
|
467
467
|
o < 128 && (s = o);
|
|
468
468
|
break;
|
|
469
469
|
case 2:
|
|
470
|
-
|
|
470
|
+
u = t[i + 1], (u & 192) === 128 && (c = (o & 31) << 6 | u & 63, c > 127 && (s = c));
|
|
471
471
|
break;
|
|
472
472
|
case 3:
|
|
473
|
-
|
|
473
|
+
u = t[i + 1], l = t[i + 2], (u & 192) === 128 && (l & 192) === 128 && (c = (o & 15) << 12 | (u & 63) << 6 | l & 63, c > 2047 && (c < 55296 || c > 57343) && (s = c));
|
|
474
474
|
break;
|
|
475
475
|
case 4:
|
|
476
|
-
|
|
476
|
+
u = t[i + 1], l = t[i + 2], h = t[i + 3], (u & 192) === 128 && (l & 192) === 128 && (h & 192) === 128 && (c = (o & 15) << 18 | (u & 63) << 12 | (l & 63) << 6 | h & 63, c > 65535 && c < 1114112 && (s = c));
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
s === null ? (s = 65533, f = 1) : s > 65535 && (s -= 65536, n.push(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), n.push(s), i += f;
|
|
@@ -661,9 +661,9 @@ a.prototype.writeIntLE = function(e, r, n, i) {
|
|
|
661
661
|
var o = Math.pow(2, 8 * n - 1);
|
|
662
662
|
D(this, e, r, n, o - 1, -o);
|
|
663
663
|
}
|
|
664
|
-
var s = 0, f = 1,
|
|
664
|
+
var s = 0, f = 1, u = 0;
|
|
665
665
|
for (this[r] = e & 255; ++s < n && (f *= 256); )
|
|
666
|
-
e < 0 &&
|
|
666
|
+
e < 0 && u === 0 && this[r + s - 1] !== 0 && (u = 1), this[r + s] = (e / f >> 0) - u & 255;
|
|
667
667
|
return r + n;
|
|
668
668
|
};
|
|
669
669
|
a.prototype.writeIntBE = function(e, r, n, i) {
|
|
@@ -671,9 +671,9 @@ a.prototype.writeIntBE = function(e, r, n, i) {
|
|
|
671
671
|
var o = Math.pow(2, 8 * n - 1);
|
|
672
672
|
D(this, e, r, n, o - 1, -o);
|
|
673
673
|
}
|
|
674
|
-
var s = n - 1, f = 1,
|
|
674
|
+
var s = n - 1, f = 1, u = 0;
|
|
675
675
|
for (this[r + s] = e & 255; --s >= 0 && (f *= 256); )
|
|
676
|
-
e < 0 &&
|
|
676
|
+
e < 0 && u === 0 && this[r + s + 1] !== 0 && (u = 1), this[r + s] = (e / f >> 0) - u & 255;
|
|
677
677
|
return r + n;
|
|
678
678
|
};
|
|
679
679
|
a.prototype.writeInt8 = function(e, r, n) {
|
|
@@ -756,9 +756,9 @@ a.prototype.fill = function(e, r, n, i) {
|
|
|
756
756
|
for (s = r; s < n; ++s)
|
|
757
757
|
this[s] = e;
|
|
758
758
|
else {
|
|
759
|
-
var f = $(e) ? e : we(new a(e, i).toString()),
|
|
759
|
+
var f = $(e) ? e : we(new a(e, i).toString()), u = f.length;
|
|
760
760
|
for (s = 0; s < n - r; ++s)
|
|
761
|
-
this[s + r] = f[s %
|
|
761
|
+
this[s + r] = f[s % u];
|
|
762
762
|
}
|
|
763
763
|
return this;
|
|
764
764
|
};
|
|
@@ -907,8 +907,8 @@ function Cr(t, e, r, n, i, o) {
|
|
|
907
907
|
if (e)
|
|
908
908
|
t.call(r, n, i, o);
|
|
909
909
|
else
|
|
910
|
-
for (var s = t.length, f = ae(t, s),
|
|
911
|
-
f[
|
|
910
|
+
for (var s = t.length, f = ae(t, s), u = 0; u < s; ++u)
|
|
911
|
+
f[u].call(r, n, i, o);
|
|
912
912
|
}
|
|
913
913
|
function Ar(t, e, r, n) {
|
|
914
914
|
if (e)
|
|
@@ -918,14 +918,14 @@ function Ar(t, e, r, n) {
|
|
|
918
918
|
o[s].apply(r, n);
|
|
919
919
|
}
|
|
920
920
|
p.prototype.emit = function(e) {
|
|
921
|
-
var r, n, i, o, s, f,
|
|
921
|
+
var r, n, i, o, s, f, u, l = e === "error";
|
|
922
922
|
if (f = this._events, f)
|
|
923
|
-
|
|
924
|
-
else if (!
|
|
923
|
+
l = l && f.error == null;
|
|
924
|
+
else if (!l)
|
|
925
925
|
return !1;
|
|
926
|
-
if (
|
|
927
|
-
if (r = arguments[1],
|
|
928
|
-
r || (r = new Error('Uncaught, unspecified "error" event')), r.domainEmitter = this, r.domain =
|
|
926
|
+
if (u = this.domain, l) {
|
|
927
|
+
if (r = arguments[1], u)
|
|
928
|
+
r || (r = new Error('Uncaught, unspecified "error" event')), r.domainEmitter = this, r.domain = u, r.domainThrown = !1, u.emit("error", r);
|
|
929
929
|
else {
|
|
930
930
|
if (r instanceof Error)
|
|
931
931
|
throw r;
|
|
@@ -1200,7 +1200,7 @@ function Ur(t) {
|
|
|
1200
1200
|
return f;
|
|
1201
1201
|
}
|
|
1202
1202
|
}), s = n[r]; r < i; s = n[++r])
|
|
1203
|
-
ze(s) || !
|
|
1203
|
+
ze(s) || !ue(s) ? o += " " + s : o += " " + G(s);
|
|
1204
1204
|
return o;
|
|
1205
1205
|
}
|
|
1206
1206
|
function Dt(t, e) {
|
|
@@ -1306,20 +1306,20 @@ function ye(t, e, r) {
|
|
|
1306
1306
|
if (Le(e))
|
|
1307
1307
|
return Ae(e);
|
|
1308
1308
|
}
|
|
1309
|
-
var
|
|
1310
|
-
if (Jr(e) && (
|
|
1309
|
+
var u = "", l = !1, h = ["{", "}"];
|
|
1310
|
+
if (Jr(e) && (l = !0, h = ["[", "]"]), Ne(e)) {
|
|
1311
1311
|
var c = e.name ? ": " + e.name : "";
|
|
1312
|
-
|
|
1312
|
+
u = " [Function" + c + "]";
|
|
1313
1313
|
}
|
|
1314
|
-
if (Te(e) && (
|
|
1315
|
-
return h[0] +
|
|
1314
|
+
if (Te(e) && (u = " " + RegExp.prototype.toString.call(e)), Xe(e) && (u = " " + Date.prototype.toUTCString.call(e)), Le(e) && (u = " " + Ae(e)), o.length === 0 && (!l || e.length == 0))
|
|
1315
|
+
return h[0] + u + h[1];
|
|
1316
1316
|
if (r < 0)
|
|
1317
1317
|
return Te(e) ? t.stylize(RegExp.prototype.toString.call(e), "regexp") : t.stylize("[Object]", "special");
|
|
1318
1318
|
t.seen.push(e);
|
|
1319
|
-
var
|
|
1320
|
-
return
|
|
1321
|
-
return ke(t, e, r, s,
|
|
1322
|
-
}), t.seen.pop(), Vr(
|
|
1319
|
+
var g;
|
|
1320
|
+
return l ? g = zr(t, e, r, s, o) : g = o.map(function(y) {
|
|
1321
|
+
return ke(t, e, r, s, y, l);
|
|
1322
|
+
}), t.seen.pop(), Vr(g, u, h);
|
|
1323
1323
|
}
|
|
1324
1324
|
function qr(t, e) {
|
|
1325
1325
|
if (H(e))
|
|
@@ -1348,28 +1348,28 @@ function zr(t, e, r, n, i) {
|
|
|
1348
1348
|
String(s),
|
|
1349
1349
|
!0
|
|
1350
1350
|
)) : o.push("");
|
|
1351
|
-
return i.forEach(function(
|
|
1352
|
-
|
|
1351
|
+
return i.forEach(function(u) {
|
|
1352
|
+
u.match(/^\d+$/) || o.push(ke(
|
|
1353
1353
|
t,
|
|
1354
1354
|
e,
|
|
1355
1355
|
r,
|
|
1356
1356
|
n,
|
|
1357
|
-
|
|
1357
|
+
u,
|
|
1358
1358
|
!0
|
|
1359
1359
|
));
|
|
1360
1360
|
}), o;
|
|
1361
1361
|
}
|
|
1362
1362
|
function ke(t, e, r, n, i, o) {
|
|
1363
|
-
var s, f,
|
|
1364
|
-
if (
|
|
1363
|
+
var s, f, u;
|
|
1364
|
+
if (u = Object.getOwnPropertyDescriptor(e, i) || { value: e[i] }, u.get ? u.set ? f = t.stylize("[Getter/Setter]", "special") : f = t.stylize("[Getter]", "special") : u.set && (f = t.stylize("[Setter]", "special")), Mt(n, i) || (s = "[" + i + "]"), f || (t.seen.indexOf(u.value) < 0 ? (ze(r) ? f = ye(t, u.value, null) : f = ye(t, u.value, r - 1), f.indexOf(`
|
|
1365
1365
|
`) > -1 && (o ? f = f.split(`
|
|
1366
|
-
`).map(function(
|
|
1367
|
-
return " " +
|
|
1366
|
+
`).map(function(l) {
|
|
1367
|
+
return " " + l;
|
|
1368
1368
|
}).join(`
|
|
1369
1369
|
`).substr(2) : f = `
|
|
1370
1370
|
` + f.split(`
|
|
1371
|
-
`).map(function(
|
|
1372
|
-
return " " +
|
|
1371
|
+
`).map(function(l) {
|
|
1372
|
+
return " " + l;
|
|
1373
1373
|
}).join(`
|
|
1374
1374
|
`))) : f = t.stylize("[Circular]", "special")), H(s)) {
|
|
1375
1375
|
if (o && i.match(/^\d+$/))
|
|
@@ -1406,16 +1406,16 @@ function H(t) {
|
|
|
1406
1406
|
return t === void 0;
|
|
1407
1407
|
}
|
|
1408
1408
|
function Te(t) {
|
|
1409
|
-
return
|
|
1409
|
+
return ue(t) && Je(t) === "[object RegExp]";
|
|
1410
1410
|
}
|
|
1411
|
-
function
|
|
1411
|
+
function ue(t) {
|
|
1412
1412
|
return typeof t == "object" && t !== null;
|
|
1413
1413
|
}
|
|
1414
1414
|
function Xe(t) {
|
|
1415
|
-
return
|
|
1415
|
+
return ue(t) && Je(t) === "[object Date]";
|
|
1416
1416
|
}
|
|
1417
1417
|
function Le(t) {
|
|
1418
|
-
return
|
|
1418
|
+
return ue(t) && (Je(t) === "[object Error]" || t instanceof Error);
|
|
1419
1419
|
}
|
|
1420
1420
|
function Ne(t) {
|
|
1421
1421
|
return typeof t == "function";
|
|
@@ -1424,7 +1424,7 @@ function Je(t) {
|
|
|
1424
1424
|
return Object.prototype.toString.call(t);
|
|
1425
1425
|
}
|
|
1426
1426
|
function Wr(t, e) {
|
|
1427
|
-
if (!e || !
|
|
1427
|
+
if (!e || !ue(e)) return t;
|
|
1428
1428
|
for (var r = Object.keys(e), n = r.length; n--; )
|
|
1429
1429
|
t[r[n]] = e[r[n]];
|
|
1430
1430
|
return t;
|
|
@@ -1487,7 +1487,7 @@ function Qr(t) {
|
|
|
1487
1487
|
if (t && !Hr(t))
|
|
1488
1488
|
throw new Error("Unknown encoding: " + t);
|
|
1489
1489
|
}
|
|
1490
|
-
function
|
|
1490
|
+
function le(t) {
|
|
1491
1491
|
switch (this.encoding = (t || "utf8").toLowerCase().replace(/[-_]/, ""), Qr(t), this.encoding) {
|
|
1492
1492
|
case "utf8":
|
|
1493
1493
|
this.surrogateSize = 3;
|
|
@@ -1505,7 +1505,7 @@ function ue(t) {
|
|
|
1505
1505
|
}
|
|
1506
1506
|
this.charBuffer = new a(6), this.charReceived = 0, this.charLength = 0;
|
|
1507
1507
|
}
|
|
1508
|
-
|
|
1508
|
+
le.prototype.write = function(t) {
|
|
1509
1509
|
for (var e = ""; this.charLength; ) {
|
|
1510
1510
|
var r = t.length >= this.charLength - this.charReceived ? this.charLength - this.charReceived : t.length;
|
|
1511
1511
|
if (t.copy(this.charBuffer, this.charReceived, 0, r), this.charReceived += r, this.charReceived < this.charLength)
|
|
@@ -1530,7 +1530,7 @@ ue.prototype.write = function(t) {
|
|
|
1530
1530
|
}
|
|
1531
1531
|
return e;
|
|
1532
1532
|
};
|
|
1533
|
-
|
|
1533
|
+
le.prototype.detectIncompleteChar = function(t) {
|
|
1534
1534
|
for (var e = t.length >= 3 ? 3 : t.length; e > 0; e--) {
|
|
1535
1535
|
var r = t[t.length - e];
|
|
1536
1536
|
if (e == 1 && r >> 5 == 6) {
|
|
@@ -1548,7 +1548,7 @@ ue.prototype.detectIncompleteChar = function(t) {
|
|
|
1548
1548
|
}
|
|
1549
1549
|
this.charReceived = e;
|
|
1550
1550
|
};
|
|
1551
|
-
|
|
1551
|
+
le.prototype.end = function(t) {
|
|
1552
1552
|
var e = "";
|
|
1553
1553
|
if (t && t.length && (e = this.write(t)), this.charReceived) {
|
|
1554
1554
|
var r = this.charReceived, n = this.charBuffer, i = this.encoding;
|
|
@@ -1579,7 +1579,7 @@ function en(t, e) {
|
|
|
1579
1579
|
function Bt(t, e) {
|
|
1580
1580
|
t = t || {}, this.objectMode = !!t.objectMode, e instanceof M && (this.objectMode = this.objectMode || !!t.readableObjectMode);
|
|
1581
1581
|
var r = t.highWaterMark, n = this.objectMode ? 16 : 16 * 1024;
|
|
1582
|
-
this.highWaterMark = r || r === 0 ? r : n, this.highWaterMark = ~~this.highWaterMark, this.buffer = new te(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.defaultEncoding = t.defaultEncoding || "utf8", this.ranOut = !1, this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, t.encoding && (this.decoder = new
|
|
1582
|
+
this.highWaterMark = r || r === 0 ? r : n, this.highWaterMark = ~~this.highWaterMark, this.buffer = new te(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.defaultEncoding = t.defaultEncoding || "utf8", this.ranOut = !1, this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, t.encoding && (this.decoder = new le(t.encoding), this.encoding = t.encoding);
|
|
1583
1583
|
}
|
|
1584
1584
|
function R(t) {
|
|
1585
1585
|
if (!(this instanceof R)) return new R(t);
|
|
@@ -1610,8 +1610,8 @@ function Ut(t, e, r, n, i) {
|
|
|
1610
1610
|
var f = new Error("stream.unshift() after end event");
|
|
1611
1611
|
t.emit("error", f);
|
|
1612
1612
|
} else {
|
|
1613
|
-
var
|
|
1614
|
-
e.decoder && !i && !n && (r = e.decoder.write(r),
|
|
1613
|
+
var u;
|
|
1614
|
+
e.decoder && !i && !n && (r = e.decoder.write(r), u = !e.objectMode && r.length === 0), i || (e.reading = !1), u || (e.flowing && e.length === 0 && !e.sync ? (t.emit("data", r), t.read(0)) : (e.length += e.objectMode ? 1 : r.length, i ? e.buffer.unshift(r) : e.buffer.push(r), e.needReadable && Se(t))), sn(t, e);
|
|
1615
1615
|
}
|
|
1616
1616
|
else i || (e.reading = !1);
|
|
1617
1617
|
return tn(e);
|
|
@@ -1620,7 +1620,7 @@ function tn(t) {
|
|
|
1620
1620
|
return !t.ended && (t.needReadable || t.length < t.highWaterMark || t.length === 0);
|
|
1621
1621
|
}
|
|
1622
1622
|
R.prototype.setEncoding = function(t) {
|
|
1623
|
-
return this._readableState.decoder = new
|
|
1623
|
+
return this._readableState.decoder = new le(t), this._readableState.encoding = t, this;
|
|
1624
1624
|
};
|
|
1625
1625
|
var Ke = 8388608;
|
|
1626
1626
|
function rn(t) {
|
|
@@ -1694,23 +1694,23 @@ R.prototype.pipe = function(t, e) {
|
|
|
1694
1694
|
function f() {
|
|
1695
1695
|
b("onend"), t.end();
|
|
1696
1696
|
}
|
|
1697
|
-
var
|
|
1698
|
-
t.on("drain",
|
|
1699
|
-
var
|
|
1697
|
+
var u = an(r);
|
|
1698
|
+
t.on("drain", u);
|
|
1699
|
+
var l = !1;
|
|
1700
1700
|
function h() {
|
|
1701
|
-
b("cleanup"), t.removeListener("close", O), t.removeListener("finish", E), t.removeListener("drain",
|
|
1701
|
+
b("cleanup"), t.removeListener("close", O), t.removeListener("finish", E), t.removeListener("drain", u), t.removeListener("error", y), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", h), r.removeListener("data", g), l = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && u();
|
|
1702
1702
|
}
|
|
1703
1703
|
var c = !1;
|
|
1704
|
-
r.on("data",
|
|
1705
|
-
function
|
|
1704
|
+
r.on("data", g);
|
|
1705
|
+
function g(S) {
|
|
1706
1706
|
b("ondata"), c = !1;
|
|
1707
|
-
var
|
|
1708
|
-
|
|
1707
|
+
var m = t.write(S);
|
|
1708
|
+
m === !1 && !c && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && Pt(n.pipes, t) !== -1) && !l && (b("false write response, pause", r._readableState.awaitDrain), r._readableState.awaitDrain++, c = !0), r.pause());
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1711
|
-
b("onerror", S), x(), t.removeListener("error",
|
|
1710
|
+
function y(S) {
|
|
1711
|
+
b("onerror", S), x(), t.removeListener("error", y), en(t, "error") === 0 && t.emit("error", S);
|
|
1712
1712
|
}
|
|
1713
|
-
Kr(t, "error",
|
|
1713
|
+
Kr(t, "error", y);
|
|
1714
1714
|
function O() {
|
|
1715
1715
|
t.removeListener("finish", E), x();
|
|
1716
1716
|
}
|
|
@@ -1751,19 +1751,19 @@ R.prototype.on = function(t, e) {
|
|
|
1751
1751
|
this._readableState.flowing !== !1 && this.resume();
|
|
1752
1752
|
else if (t === "readable") {
|
|
1753
1753
|
var n = this._readableState;
|
|
1754
|
-
!n.endEmitted && !n.readableListening && (n.readableListening = n.needReadable = !0, n.emittedReadable = !1, n.reading ? n.length && Se(this) : B(
|
|
1754
|
+
!n.endEmitted && !n.readableListening && (n.readableListening = n.needReadable = !0, n.emittedReadable = !1, n.reading ? n.length && Se(this) : B(un, this));
|
|
1755
1755
|
}
|
|
1756
1756
|
return r;
|
|
1757
1757
|
};
|
|
1758
1758
|
R.prototype.addListener = R.prototype.on;
|
|
1759
|
-
function
|
|
1759
|
+
function un(t) {
|
|
1760
1760
|
b("readable nexttick read 0"), t.read(0);
|
|
1761
1761
|
}
|
|
1762
1762
|
R.prototype.resume = function() {
|
|
1763
1763
|
var t = this._readableState;
|
|
1764
|
-
return t.flowing || (b("resume"), t.flowing = !0,
|
|
1764
|
+
return t.flowing || (b("resume"), t.flowing = !0, ln(this, t)), this;
|
|
1765
1765
|
};
|
|
1766
|
-
function
|
|
1766
|
+
function ln(t, e) {
|
|
1767
1767
|
e.resumeScheduled || (e.resumeScheduled = !0, B(hn, t, e));
|
|
1768
1768
|
}
|
|
1769
1769
|
function hn(t, e) {
|
|
@@ -1960,8 +1960,8 @@ function $t(t, e) {
|
|
|
1960
1960
|
Pe(t, e, !0, e.length, i, "", o.finish), e.pendingcb++, e.lastBufferedRequest = null, o.next ? (e.corkedRequestsFree = o.next, o.next = null) : e.corkedRequestsFree = new zt(e);
|
|
1961
1961
|
} else {
|
|
1962
1962
|
for (; r; ) {
|
|
1963
|
-
var f = r.chunk,
|
|
1964
|
-
if (Pe(t, e, !1, h, f,
|
|
1963
|
+
var f = r.chunk, u = r.encoding, l = r.callback, h = e.objectMode ? 1 : f.length;
|
|
1964
|
+
if (Pe(t, e, !1, h, f, u, l), r = r.next, e.writing)
|
|
1965
1965
|
break;
|
|
1966
1966
|
}
|
|
1967
1967
|
r === null && (e.lastBufferedRequest = null);
|
|
@@ -2100,22 +2100,22 @@ V.prototype.pipe = function(t, e) {
|
|
|
2100
2100
|
function f() {
|
|
2101
2101
|
o || (o = !0, typeof t.destroy == "function" && t.destroy());
|
|
2102
2102
|
}
|
|
2103
|
-
function
|
|
2104
|
-
if (
|
|
2103
|
+
function u(h) {
|
|
2104
|
+
if (l(), p.listenerCount(this, "error") === 0)
|
|
2105
2105
|
throw h;
|
|
2106
2106
|
}
|
|
2107
|
-
r.on("error",
|
|
2108
|
-
function
|
|
2109
|
-
r.removeListener("data", n), t.removeListener("drain", i), r.removeListener("end", s), r.removeListener("close", f), r.removeListener("error",
|
|
2107
|
+
r.on("error", u), t.on("error", u);
|
|
2108
|
+
function l() {
|
|
2109
|
+
r.removeListener("data", n), t.removeListener("drain", i), r.removeListener("end", s), r.removeListener("close", f), r.removeListener("error", u), t.removeListener("error", u), r.removeListener("end", l), r.removeListener("close", l), t.removeListener("close", l);
|
|
2110
2110
|
}
|
|
2111
|
-
return r.on("end",
|
|
2111
|
+
return r.on("end", l), r.on("close", l), t.on("close", l), t.emit("pipe", r), t;
|
|
2112
2112
|
};
|
|
2113
2113
|
const Vt = function(t) {
|
|
2114
2114
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
2115
2115
|
};
|
|
2116
|
-
class
|
|
2116
|
+
class w extends Error {
|
|
2117
2117
|
constructor(e, r, n, ...i) {
|
|
2118
|
-
Array.isArray(r) && (r = r.join(" ").trim()), super(r), Error.captureStackTrace !== void 0 && Error.captureStackTrace(this,
|
|
2118
|
+
Array.isArray(r) && (r = r.join(" ").trim()), super(r), Error.captureStackTrace !== void 0 && Error.captureStackTrace(this, w), this.code = e;
|
|
2119
2119
|
for (const o of i)
|
|
2120
2120
|
for (const s in o) {
|
|
2121
2121
|
const f = o[s];
|
|
@@ -2133,14 +2133,14 @@ const Jt = function(t) {
|
|
|
2133
2133
|
e[r] = { name: i };
|
|
2134
2134
|
else if (Vt(i)) {
|
|
2135
2135
|
if (typeof i.name != "string")
|
|
2136
|
-
throw new
|
|
2136
|
+
throw new w("CSV_OPTION_COLUMNS_MISSING_NAME", [
|
|
2137
2137
|
"Option columns missing name:",
|
|
2138
2138
|
`property "name" is required at position ${r}`,
|
|
2139
2139
|
"when column is an object literal"
|
|
2140
2140
|
]);
|
|
2141
2141
|
e[r] = i;
|
|
2142
2142
|
} else
|
|
2143
|
-
throw new
|
|
2143
|
+
throw new w("CSV_INVALID_COLUMN_DEFINITION", [
|
|
2144
2144
|
"Invalid column definition:",
|
|
2145
2145
|
"expect a string or a literal object,",
|
|
2146
2146
|
`got ${JSON.stringify(i)} at position ${r}`
|
|
@@ -2246,7 +2246,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2246
2246
|
else if (e.encoding === null || e.encoding === !1)
|
|
2247
2247
|
e.encoding = null;
|
|
2248
2248
|
else if (typeof e.encoding != "string" && e.encoding !== null)
|
|
2249
|
-
throw new
|
|
2249
|
+
throw new w(
|
|
2250
2250
|
"CSV_INVALID_OPTION_ENCODING",
|
|
2251
2251
|
[
|
|
2252
2252
|
"Invalid option encoding:",
|
|
@@ -2258,7 +2258,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2258
2258
|
if (e.bom === void 0 || e.bom === null || e.bom === !1)
|
|
2259
2259
|
e.bom = !1;
|
|
2260
2260
|
else if (e.bom !== !0)
|
|
2261
|
-
throw new
|
|
2261
|
+
throw new w(
|
|
2262
2262
|
"CSV_INVALID_OPTION_BOM",
|
|
2263
2263
|
[
|
|
2264
2264
|
"Invalid option bom:",
|
|
@@ -2272,7 +2272,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2272
2272
|
else if (typeof e.cast == "function")
|
|
2273
2273
|
e.cast_function = e.cast, e.cast = !0;
|
|
2274
2274
|
else if (e.cast !== !0)
|
|
2275
|
-
throw new
|
|
2275
|
+
throw new w(
|
|
2276
2276
|
"CSV_INVALID_OPTION_CAST",
|
|
2277
2277
|
[
|
|
2278
2278
|
"Invalid option cast:",
|
|
@@ -2289,7 +2289,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2289
2289
|
return isNaN(i) ? n : new Date(i);
|
|
2290
2290
|
};
|
|
2291
2291
|
else if (typeof e.cast_date != "function")
|
|
2292
|
-
throw new
|
|
2292
|
+
throw new w(
|
|
2293
2293
|
"CSV_INVALID_OPTION_CAST_DATE",
|
|
2294
2294
|
[
|
|
2295
2295
|
"Invalid option cast_date:",
|
|
@@ -2307,7 +2307,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2307
2307
|
else if (e.columns === void 0 || e.columns === null || e.columns === !1)
|
|
2308
2308
|
e.columns = !1;
|
|
2309
2309
|
else
|
|
2310
|
-
throw new
|
|
2310
|
+
throw new w(
|
|
2311
2311
|
"CSV_INVALID_OPTION_COLUMNS",
|
|
2312
2312
|
[
|
|
2313
2313
|
"Invalid option columns:",
|
|
@@ -2320,7 +2320,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2320
2320
|
e.group_columns_by_name = !1;
|
|
2321
2321
|
else {
|
|
2322
2322
|
if (e.group_columns_by_name !== !0)
|
|
2323
|
-
throw new
|
|
2323
|
+
throw new w(
|
|
2324
2324
|
"CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",
|
|
2325
2325
|
[
|
|
2326
2326
|
"Invalid option group_columns_by_name:",
|
|
@@ -2330,7 +2330,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2330
2330
|
e
|
|
2331
2331
|
);
|
|
2332
2332
|
if (e.columns === !1)
|
|
2333
|
-
throw new
|
|
2333
|
+
throw new w(
|
|
2334
2334
|
"CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",
|
|
2335
2335
|
[
|
|
2336
2336
|
"Invalid option group_columns_by_name:",
|
|
@@ -2342,7 +2342,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2342
2342
|
if (e.comment === void 0 || e.comment === null || e.comment === !1 || e.comment === "")
|
|
2343
2343
|
e.comment = null;
|
|
2344
2344
|
else if (typeof e.comment == "string" && (e.comment = a.from(e.comment, e.encoding)), !N(e.comment))
|
|
2345
|
-
throw new
|
|
2345
|
+
throw new w(
|
|
2346
2346
|
"CSV_INVALID_OPTION_COMMENT",
|
|
2347
2347
|
[
|
|
2348
2348
|
"Invalid option comment:",
|
|
@@ -2354,7 +2354,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2354
2354
|
if (e.comment_no_infix === void 0 || e.comment_no_infix === null || e.comment_no_infix === !1)
|
|
2355
2355
|
e.comment_no_infix = !1;
|
|
2356
2356
|
else if (e.comment_no_infix !== !0)
|
|
2357
|
-
throw new
|
|
2357
|
+
throw new w(
|
|
2358
2358
|
"CSV_INVALID_OPTION_COMMENT",
|
|
2359
2359
|
[
|
|
2360
2360
|
"Invalid option comment_no_infix:",
|
|
@@ -2365,7 +2365,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2365
2365
|
);
|
|
2366
2366
|
const r = JSON.stringify(e.delimiter);
|
|
2367
2367
|
if (Array.isArray(e.delimiter) || (e.delimiter = [e.delimiter]), e.delimiter.length === 0)
|
|
2368
|
-
throw new
|
|
2368
|
+
throw new w(
|
|
2369
2369
|
"CSV_INVALID_OPTION_DELIMITER",
|
|
2370
2370
|
[
|
|
2371
2371
|
"Invalid option delimiter:",
|
|
@@ -2378,7 +2378,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2378
2378
|
if (n == null || n === !1)
|
|
2379
2379
|
return a.from(",", e.encoding);
|
|
2380
2380
|
if (typeof n == "string" && (n = a.from(n, e.encoding)), !N(n) || n.length === 0)
|
|
2381
|
-
throw new
|
|
2381
|
+
throw new w(
|
|
2382
2382
|
"CSV_INVALID_OPTION_DELIMITER",
|
|
2383
2383
|
[
|
|
2384
2384
|
"Invalid option delimiter:",
|
|
@@ -2419,7 +2419,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2419
2419
|
else if (typeof e.ignore_last_delimiters == "number")
|
|
2420
2420
|
e.ignore_last_delimiters = Math.floor(e.ignore_last_delimiters), e.ignore_last_delimiters === 0 && (e.ignore_last_delimiters = !1);
|
|
2421
2421
|
else if (typeof e.ignore_last_delimiters != "boolean")
|
|
2422
|
-
throw new
|
|
2422
|
+
throw new w(
|
|
2423
2423
|
"CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",
|
|
2424
2424
|
[
|
|
2425
2425
|
"Invalid option `ignore_last_delimiters`:",
|
|
@@ -2429,7 +2429,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2429
2429
|
e
|
|
2430
2430
|
);
|
|
2431
2431
|
if (e.ignore_last_delimiters === !0 && e.columns === !1)
|
|
2432
|
-
throw new
|
|
2432
|
+
throw new w(
|
|
2433
2433
|
"CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",
|
|
2434
2434
|
[
|
|
2435
2435
|
"The option `ignore_last_delimiters`",
|
|
@@ -2477,7 +2477,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2477
2477
|
if (e.on_record === void 0 || e.on_record === null)
|
|
2478
2478
|
e.on_record = void 0;
|
|
2479
2479
|
else if (typeof e.on_record != "function")
|
|
2480
|
-
throw new
|
|
2480
|
+
throw new w(
|
|
2481
2481
|
"CSV_INVALID_OPTION_ON_RECORD",
|
|
2482
2482
|
[
|
|
2483
2483
|
"Invalid option `on_record`:",
|
|
@@ -2506,7 +2506,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2506
2506
|
e.record_delimiter = [];
|
|
2507
2507
|
else if (typeof e.record_delimiter == "string" || N(e.record_delimiter)) {
|
|
2508
2508
|
if (e.record_delimiter.length === 0)
|
|
2509
|
-
throw new
|
|
2509
|
+
throw new w(
|
|
2510
2510
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2511
2511
|
[
|
|
2512
2512
|
"Invalid option `record_delimiter`:",
|
|
@@ -2517,7 +2517,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2517
2517
|
);
|
|
2518
2518
|
e.record_delimiter = [e.record_delimiter];
|
|
2519
2519
|
} else if (!Array.isArray(e.record_delimiter))
|
|
2520
|
-
throw new
|
|
2520
|
+
throw new w(
|
|
2521
2521
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2522
2522
|
[
|
|
2523
2523
|
"Invalid option `record_delimiter`:",
|
|
@@ -2528,7 +2528,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2528
2528
|
);
|
|
2529
2529
|
if (e.record_delimiter = e.record_delimiter.map(function(n, i) {
|
|
2530
2530
|
if (typeof n != "string" && !N(n))
|
|
2531
|
-
throw new
|
|
2531
|
+
throw new w(
|
|
2532
2532
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2533
2533
|
[
|
|
2534
2534
|
"Invalid option `record_delimiter`:",
|
|
@@ -2539,7 +2539,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2539
2539
|
e
|
|
2540
2540
|
);
|
|
2541
2541
|
if (n.length === 0)
|
|
2542
|
-
throw new
|
|
2542
|
+
throw new w(
|
|
2543
2543
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2544
2544
|
[
|
|
2545
2545
|
"Invalid option `record_delimiter`:",
|
|
@@ -2665,7 +2665,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2665
2665
|
state: Un(r),
|
|
2666
2666
|
__needMoreData: function(n, i, o) {
|
|
2667
2667
|
if (o) return !1;
|
|
2668
|
-
const { encoding: s, escape: f, quote:
|
|
2668
|
+
const { encoding: s, escape: f, quote: u } = this.options, { quoting: l, needMoreDataSize: h, recordDelimiterMaxLength: c } = this.state, g = i - n - 1, y = Math.max(
|
|
2669
2669
|
h,
|
|
2670
2670
|
// Skip if the remaining buffer smaller than record delimiter
|
|
2671
2671
|
// If "record_delimiter" is yet to be discovered:
|
|
@@ -2676,29 +2676,29 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2676
2676
|
c === 0 ? a.from(`\r
|
|
2677
2677
|
`, s).length : c,
|
|
2678
2678
|
// Skip if remaining buffer can be an escaped quote
|
|
2679
|
-
|
|
2679
|
+
l ? (f === null ? 0 : f.length) + u.length : 0,
|
|
2680
2680
|
// Skip if remaining buffer can be record delimiter following the closing quote
|
|
2681
|
-
|
|
2681
|
+
l ? u.length + c : 0
|
|
2682
2682
|
);
|
|
2683
|
-
return
|
|
2683
|
+
return g < y;
|
|
2684
2684
|
},
|
|
2685
2685
|
// Central parser implementation
|
|
2686
2686
|
parse: function(n, i, o, s) {
|
|
2687
2687
|
const {
|
|
2688
2688
|
bom: f,
|
|
2689
|
-
comment_no_infix:
|
|
2690
|
-
encoding:
|
|
2689
|
+
comment_no_infix: u,
|
|
2690
|
+
encoding: l,
|
|
2691
2691
|
from_line: h,
|
|
2692
2692
|
ltrim: c,
|
|
2693
|
-
max_record_size:
|
|
2694
|
-
raw:
|
|
2693
|
+
max_record_size: g,
|
|
2694
|
+
raw: y,
|
|
2695
2695
|
relax_quotes: O,
|
|
2696
2696
|
rtrim: E,
|
|
2697
2697
|
skip_empty_lines: x,
|
|
2698
2698
|
to: S,
|
|
2699
|
-
to_line:
|
|
2699
|
+
to_line: m
|
|
2700
2700
|
} = this.options;
|
|
2701
|
-
let { comment:
|
|
2701
|
+
let { comment: _, escape: L, quote: U, record_delimiter: Re } = this.options;
|
|
2702
2702
|
const { bomSkipped: Yt, previousBuf: he, rawBuffer: Wt, escapeIsQuote: Ht } = this.state;
|
|
2703
2703
|
let v;
|
|
2704
2704
|
if (he === void 0)
|
|
@@ -2727,7 +2727,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2727
2727
|
});
|
|
2728
2728
|
for (const C in ce)
|
|
2729
2729
|
this.options[C] = ce[C];
|
|
2730
|
-
({ comment:
|
|
2730
|
+
({ comment: _, escape: L, quote: U } = this.options);
|
|
2731
2731
|
break;
|
|
2732
2732
|
}
|
|
2733
2733
|
this.state.bomSkipped = !0;
|
|
@@ -2735,7 +2735,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2735
2735
|
const Ie = v.length;
|
|
2736
2736
|
let d;
|
|
2737
2737
|
for (d = 0; d < Ie && !this.__needMoreData(d, Ie, i); d++) {
|
|
2738
|
-
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1),
|
|
2738
|
+
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1), m !== -1 && this.info.lines > m) {
|
|
2739
2739
|
this.state.stop = !0, s();
|
|
2740
2740
|
return;
|
|
2741
2741
|
}
|
|
@@ -2744,7 +2744,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2744
2744
|
d
|
|
2745
2745
|
) && (Re = this.options.record_delimiter);
|
|
2746
2746
|
const I = v[d];
|
|
2747
|
-
if (
|
|
2747
|
+
if (y === !0 && Wt.append(I), (I === Pn || I === $n) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0)
|
|
2748
2748
|
this.state.escaping = !1;
|
|
2749
2749
|
else {
|
|
2750
2750
|
if (L !== null && this.state.quoting === !0 && this.__isEscape(v, d, I) && d + L.length < Ie)
|
|
@@ -2759,7 +2759,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2759
2759
|
}
|
|
2760
2760
|
if (this.state.commenting === !1 && this.__isQuote(v, d))
|
|
2761
2761
|
if (this.state.quoting === !0) {
|
|
2762
|
-
const C = v[d + U.length], Z = E && this.__isCharTrimable(v, d + U.length), j =
|
|
2762
|
+
const C = v[d + U.length], Z = E && this.__isCharTrimable(v, d + U.length), j = _ !== null && this.__compareBytes(_, v, d + U.length, C), X = this.__isDelimiter(
|
|
2763
2763
|
v,
|
|
2764
2764
|
d + U.length,
|
|
2765
2765
|
C
|
|
@@ -2771,7 +2771,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2771
2771
|
continue;
|
|
2772
2772
|
} else if (O === !1) {
|
|
2773
2773
|
const He = this.__error(
|
|
2774
|
-
new
|
|
2774
|
+
new w(
|
|
2775
2775
|
"CSV_INVALID_CLOSING_QUOTE",
|
|
2776
2776
|
[
|
|
2777
2777
|
"Invalid Closing Quote:",
|
|
@@ -2792,11 +2792,11 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2792
2792
|
const C = this.__infoField(), Z = Object.keys(re).map(
|
|
2793
2793
|
(X) => re[X].equals(this.state.field.toString()) ? X : !1
|
|
2794
2794
|
).filter(Boolean)[0], j = this.__error(
|
|
2795
|
-
new
|
|
2795
|
+
new w(
|
|
2796
2796
|
"INVALID_OPENING_QUOTE",
|
|
2797
2797
|
[
|
|
2798
2798
|
"Invalid Opening Quote:",
|
|
2799
|
-
`a quote is found on field ${JSON.stringify(C.column)} at line ${C.lines}, value is ${JSON.stringify(this.state.field.toString(
|
|
2799
|
+
`a quote is found on field ${JSON.stringify(C.column)} at line ${C.lines}, value is ${JSON.stringify(this.state.field.toString(l))}`,
|
|
2800
2800
|
Z ? `(${Z} bom)` : void 0
|
|
2801
2801
|
],
|
|
2802
2802
|
this.options,
|
|
@@ -2846,7 +2846,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2846
2846
|
}
|
|
2847
2847
|
if (this.state.commenting)
|
|
2848
2848
|
continue;
|
|
2849
|
-
if (
|
|
2849
|
+
if (_ !== null && (u === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(_, v, d, I) !== 0) {
|
|
2850
2850
|
this.state.commenting = !0;
|
|
2851
2851
|
continue;
|
|
2852
2852
|
}
|
|
@@ -2860,14 +2860,14 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2860
2860
|
}
|
|
2861
2861
|
}
|
|
2862
2862
|
}
|
|
2863
|
-
if (this.state.commenting === !1 &&
|
|
2863
|
+
if (this.state.commenting === !1 && g !== 0 && this.state.record_length + this.state.field.length > g)
|
|
2864
2864
|
return this.__error(
|
|
2865
|
-
new
|
|
2865
|
+
new w(
|
|
2866
2866
|
"CSV_MAX_RECORD_SIZE",
|
|
2867
2867
|
[
|
|
2868
2868
|
"Max Record Size:",
|
|
2869
2869
|
"record exceed the maximum number of tolerated bytes",
|
|
2870
|
-
`of ${
|
|
2870
|
+
`of ${g}`,
|
|
2871
2871
|
`at line ${this.info.lines}`
|
|
2872
2872
|
],
|
|
2873
2873
|
this.options,
|
|
@@ -2880,7 +2880,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2880
2880
|
else {
|
|
2881
2881
|
if (E === !0 && !this.__isCharTrimable(v, d))
|
|
2882
2882
|
return this.__error(
|
|
2883
|
-
new
|
|
2883
|
+
new w(
|
|
2884
2884
|
"CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",
|
|
2885
2885
|
[
|
|
2886
2886
|
"Invalid Closing Quote:",
|
|
@@ -2898,7 +2898,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2898
2898
|
if (i === !0)
|
|
2899
2899
|
if (this.state.quoting === !0) {
|
|
2900
2900
|
const I = this.__error(
|
|
2901
|
-
new
|
|
2901
|
+
new w(
|
|
2902
2902
|
"CSV_QUOTE_NOT_CLOSED",
|
|
2903
2903
|
[
|
|
2904
2904
|
"Quote Not Closed:",
|
|
@@ -2926,25 +2926,25 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2926
2926
|
group_columns_by_name: o,
|
|
2927
2927
|
encoding: s,
|
|
2928
2928
|
info: f,
|
|
2929
|
-
from:
|
|
2930
|
-
relax_column_count:
|
|
2929
|
+
from: u,
|
|
2930
|
+
relax_column_count: l,
|
|
2931
2931
|
relax_column_count_less: h,
|
|
2932
2932
|
relax_column_count_more: c,
|
|
2933
|
-
raw:
|
|
2934
|
-
skip_records_with_empty_values:
|
|
2933
|
+
raw: g,
|
|
2934
|
+
skip_records_with_empty_values: y
|
|
2935
2935
|
} = this.options, { enabled: O, record: E } = this.state;
|
|
2936
2936
|
if (O === !1)
|
|
2937
2937
|
return this.__resetRecord();
|
|
2938
2938
|
const x = E.length;
|
|
2939
2939
|
if (i === !0) {
|
|
2940
|
-
if (
|
|
2940
|
+
if (y === !0 && at(E)) {
|
|
2941
2941
|
this.__resetRecord();
|
|
2942
2942
|
return;
|
|
2943
2943
|
}
|
|
2944
2944
|
return this.__firstLineToColumns(E);
|
|
2945
2945
|
}
|
|
2946
2946
|
if (i === !1 && this.info.records === 0 && (this.state.expectedRecordLength = x), x !== this.state.expectedRecordLength) {
|
|
2947
|
-
const S = i === !1 ? new
|
|
2947
|
+
const S = i === !1 ? new w(
|
|
2948
2948
|
"CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",
|
|
2949
2949
|
[
|
|
2950
2950
|
"Invalid Record Length:",
|
|
@@ -2956,7 +2956,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2956
2956
|
{
|
|
2957
2957
|
record: E
|
|
2958
2958
|
}
|
|
2959
|
-
) : new
|
|
2959
|
+
) : new w(
|
|
2960
2960
|
"CSV_RECORD_INCONSISTENT_COLUMNS",
|
|
2961
2961
|
[
|
|
2962
2962
|
"Invalid Record Length:",
|
|
@@ -2970,14 +2970,14 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2970
2970
|
record: E
|
|
2971
2971
|
}
|
|
2972
2972
|
);
|
|
2973
|
-
if (
|
|
2973
|
+
if (l === !0 || h === !0 && x < this.state.expectedRecordLength || c === !0 && x > this.state.expectedRecordLength)
|
|
2974
2974
|
this.info.invalid_field_length++, this.state.error = S;
|
|
2975
2975
|
else {
|
|
2976
|
-
const
|
|
2977
|
-
if (
|
|
2976
|
+
const m = this.__error(S);
|
|
2977
|
+
if (m) return m;
|
|
2978
2978
|
}
|
|
2979
2979
|
}
|
|
2980
|
-
if (
|
|
2980
|
+
if (y === !0 && at(E)) {
|
|
2981
2981
|
this.__resetRecord();
|
|
2982
2982
|
return;
|
|
2983
2983
|
}
|
|
@@ -2985,49 +2985,49 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2985
2985
|
this.__resetRecord(), this.state.recordHasError = !1;
|
|
2986
2986
|
return;
|
|
2987
2987
|
}
|
|
2988
|
-
if (this.info.records++,
|
|
2988
|
+
if (this.info.records++, u === 1 || this.info.records >= u) {
|
|
2989
2989
|
const { objname: S } = this.options;
|
|
2990
2990
|
if (i !== !1) {
|
|
2991
|
-
const
|
|
2992
|
-
for (let
|
|
2993
|
-
i[
|
|
2994
|
-
if (
|
|
2995
|
-
const
|
|
2996
|
-
{ record:
|
|
2997
|
-
|
|
2991
|
+
const m = {};
|
|
2992
|
+
for (let _ = 0, L = E.length; _ < L; _++)
|
|
2993
|
+
i[_] === void 0 || i[_].disabled || (o === !0 && m[i[_].name] !== void 0 ? Array.isArray(m[i[_].name]) ? m[i[_].name] = m[i[_].name].concat(E[_]) : m[i[_].name] = [m[i[_].name], E[_]] : m[i[_].name] = E[_]);
|
|
2994
|
+
if (g === !0 || f === !0) {
|
|
2995
|
+
const _ = Object.assign(
|
|
2996
|
+
{ record: m },
|
|
2997
|
+
g === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
2998
2998
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
2999
2999
|
), L = this.__push(
|
|
3000
|
-
S === void 0 ?
|
|
3000
|
+
S === void 0 ? _ : [m[S], _],
|
|
3001
3001
|
n
|
|
3002
3002
|
);
|
|
3003
3003
|
if (L)
|
|
3004
3004
|
return L;
|
|
3005
3005
|
} else {
|
|
3006
|
-
const
|
|
3007
|
-
S === void 0 ?
|
|
3006
|
+
const _ = this.__push(
|
|
3007
|
+
S === void 0 ? m : [m[S], m],
|
|
3008
3008
|
n
|
|
3009
3009
|
);
|
|
3010
|
-
if (
|
|
3011
|
-
return
|
|
3010
|
+
if (_)
|
|
3011
|
+
return _;
|
|
3012
3012
|
}
|
|
3013
|
-
} else if (
|
|
3014
|
-
const
|
|
3013
|
+
} else if (g === !0 || f === !0) {
|
|
3014
|
+
const m = Object.assign(
|
|
3015
3015
|
{ record: E },
|
|
3016
|
-
|
|
3016
|
+
g === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
3017
3017
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
3018
|
-
),
|
|
3019
|
-
S === void 0 ?
|
|
3018
|
+
), _ = this.__push(
|
|
3019
|
+
S === void 0 ? m : [E[S], m],
|
|
3020
3020
|
n
|
|
3021
3021
|
);
|
|
3022
|
-
if (
|
|
3023
|
-
return
|
|
3022
|
+
if (_)
|
|
3023
|
+
return _;
|
|
3024
3024
|
} else {
|
|
3025
|
-
const
|
|
3025
|
+
const m = this.__push(
|
|
3026
3026
|
S === void 0 ? E : [E[S], E],
|
|
3027
3027
|
n
|
|
3028
3028
|
);
|
|
3029
|
-
if (
|
|
3030
|
-
return
|
|
3029
|
+
if (m)
|
|
3030
|
+
return m;
|
|
3031
3031
|
}
|
|
3032
3032
|
}
|
|
3033
3033
|
this.__resetRecord();
|
|
@@ -3038,7 +3038,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3038
3038
|
const o = i === void 0 ? n : i.call(null, n);
|
|
3039
3039
|
if (!Array.isArray(o))
|
|
3040
3040
|
return this.__error(
|
|
3041
|
-
new
|
|
3041
|
+
new w(
|
|
3042
3042
|
"CSV_INVALID_COLUMN_MAPPING",
|
|
3043
3043
|
[
|
|
3044
3044
|
"Invalid Column Mapping:",
|
|
@@ -3063,16 +3063,16 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3063
3063
|
this.options.raw === !0 && this.state.rawBuffer.reset(), this.state.error = void 0, this.state.record = [], this.state.record_length = 0;
|
|
3064
3064
|
},
|
|
3065
3065
|
__onField: function() {
|
|
3066
|
-
const { cast: n, encoding: i, rtrim: o, max_record_size: s } = this.options, { enabled: f, wasQuoting:
|
|
3066
|
+
const { cast: n, encoding: i, rtrim: o, max_record_size: s } = this.options, { enabled: f, wasQuoting: u } = this.state;
|
|
3067
3067
|
if (f === !1)
|
|
3068
3068
|
return this.__resetField();
|
|
3069
|
-
let
|
|
3070
|
-
if (o === !0 &&
|
|
3071
|
-
const [h, c] = this.__cast(
|
|
3069
|
+
let l = this.state.field.toString(i);
|
|
3070
|
+
if (o === !0 && u === !1 && (l = l.trimRight()), n === !0) {
|
|
3071
|
+
const [h, c] = this.__cast(l);
|
|
3072
3072
|
if (h !== void 0) return h;
|
|
3073
|
-
|
|
3073
|
+
l = c;
|
|
3074
3074
|
}
|
|
3075
|
-
this.state.record.push(
|
|
3075
|
+
this.state.record.push(l), s !== 0 && typeof l == "string" && (this.state.record_length += l.length), this.__resetField();
|
|
3076
3076
|
},
|
|
3077
3077
|
__resetField: function() {
|
|
3078
3078
|
this.state.field.reset(), this.state.wasQuoting = !1;
|
|
@@ -3114,9 +3114,9 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3114
3114
|
// Helper to test if a character is a space or a line delimiter
|
|
3115
3115
|
__isCharTrimable: function(n, i) {
|
|
3116
3116
|
return ((s, f) => {
|
|
3117
|
-
const { timchars:
|
|
3118
|
-
e: for (let
|
|
3119
|
-
const h = l
|
|
3117
|
+
const { timchars: u } = this.state;
|
|
3118
|
+
e: for (let l = 0; l < u.length; l++) {
|
|
3119
|
+
const h = u[l];
|
|
3120
3120
|
for (let c = 0; c < h.length; c++)
|
|
3121
3121
|
if (h[c] !== s[f + c]) continue e;
|
|
3122
3122
|
return h.length;
|
|
@@ -3136,8 +3136,8 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3136
3136
|
__compareBytes: function(n, i, o, s) {
|
|
3137
3137
|
if (n[0] !== s) return 0;
|
|
3138
3138
|
const f = n.length;
|
|
3139
|
-
for (let
|
|
3140
|
-
if (n[
|
|
3139
|
+
for (let u = 1; u < f; u++)
|
|
3140
|
+
if (n[u] !== i[o + u]) return 0;
|
|
3141
3141
|
return f;
|
|
3142
3142
|
},
|
|
3143
3143
|
__isDelimiter: function(n, i, o) {
|
|
@@ -3146,25 +3146,25 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3146
3146
|
return 0;
|
|
3147
3147
|
if (f !== !1 && typeof f == "number" && this.state.record.length === f - 1)
|
|
3148
3148
|
return 0;
|
|
3149
|
-
e: for (let
|
|
3150
|
-
const
|
|
3151
|
-
if (
|
|
3152
|
-
for (let h = 1; h <
|
|
3153
|
-
if (
|
|
3154
|
-
return
|
|
3149
|
+
e: for (let u = 0; u < s.length; u++) {
|
|
3150
|
+
const l = s[u];
|
|
3151
|
+
if (l[0] === o) {
|
|
3152
|
+
for (let h = 1; h < l.length; h++)
|
|
3153
|
+
if (l[h] !== n[i + h]) continue e;
|
|
3154
|
+
return l.length;
|
|
3155
3155
|
}
|
|
3156
3156
|
}
|
|
3157
3157
|
return 0;
|
|
3158
3158
|
},
|
|
3159
3159
|
__isRecordDelimiter: function(n, i, o) {
|
|
3160
3160
|
const { record_delimiter: s } = this.options, f = s.length;
|
|
3161
|
-
e: for (let
|
|
3162
|
-
const
|
|
3163
|
-
if (
|
|
3161
|
+
e: for (let u = 0; u < f; u++) {
|
|
3162
|
+
const l = s[u], h = l.length;
|
|
3163
|
+
if (l[0] === n) {
|
|
3164
3164
|
for (let c = 1; c < h; c++)
|
|
3165
|
-
if (
|
|
3165
|
+
if (l[c] !== i[o + c])
|
|
3166
3166
|
continue e;
|
|
3167
|
-
return
|
|
3167
|
+
return l.length;
|
|
3168
3168
|
}
|
|
3169
3169
|
}
|
|
3170
3170
|
return 0;
|
|
@@ -3174,8 +3174,8 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3174
3174
|
if (s === null) return !1;
|
|
3175
3175
|
const f = s.length;
|
|
3176
3176
|
if (s[0] === o) {
|
|
3177
|
-
for (let
|
|
3178
|
-
if (s[
|
|
3177
|
+
for (let u = 0; u < f; u++)
|
|
3178
|
+
if (s[u] !== n[i + u])
|
|
3179
3179
|
return !1;
|
|
3180
3180
|
return !0;
|
|
3181
3181
|
}
|
|
@@ -3200,9 +3200,9 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3200
3200
|
a.from("\r", o)
|
|
3201
3201
|
];
|
|
3202
3202
|
e: for (let f = 0; f < s.length; f++) {
|
|
3203
|
-
const
|
|
3204
|
-
for (let
|
|
3205
|
-
if (s[f][
|
|
3203
|
+
const u = s[f].length;
|
|
3204
|
+
for (let l = 0; l < u; l++)
|
|
3205
|
+
if (s[f][l] !== n[i + l])
|
|
3206
3206
|
continue e;
|
|
3207
3207
|
return this.options.record_delimiter.push(s[f]), this.state.recordDelimiterMaxLength = s[f].length, s[f].length;
|
|
3208
3208
|
}
|
|
@@ -3217,8 +3217,8 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
3217
3217
|
f,
|
|
3218
3218
|
o ? this.state.rawBuffer.toString(i) : void 0
|
|
3219
3219
|
);
|
|
3220
|
-
} catch (
|
|
3221
|
-
return
|
|
3220
|
+
} catch (u) {
|
|
3221
|
+
return u;
|
|
3222
3222
|
}
|
|
3223
3223
|
return;
|
|
3224
3224
|
} else
|
|
@@ -3292,7 +3292,7 @@ class qn extends k {
|
|
|
3292
3292
|
e(r);
|
|
3293
3293
|
}
|
|
3294
3294
|
}
|
|
3295
|
-
const
|
|
3295
|
+
const ut = function() {
|
|
3296
3296
|
let t, e, r;
|
|
3297
3297
|
for (const i in arguments) {
|
|
3298
3298
|
const o = arguments[i], s = typeof o;
|
|
@@ -3303,7 +3303,7 @@ const lt = function() {
|
|
|
3303
3303
|
else if (r === void 0 && s === "function")
|
|
3304
3304
|
r = o;
|
|
3305
3305
|
else
|
|
3306
|
-
throw new
|
|
3306
|
+
throw new w(
|
|
3307
3307
|
"CSV_INVALID_ARGUMENT",
|
|
3308
3308
|
["Invalid argument:", `got ${JSON.stringify(o)} at index ${i}`],
|
|
3309
3309
|
e || {}
|
|
@@ -3377,51 +3377,61 @@ const Qn = 40096;
|
|
|
3377
3377
|
class Gn {
|
|
3378
3378
|
/** Build parser. */
|
|
3379
3379
|
buildParser(e) {
|
|
3380
|
-
return
|
|
3380
|
+
return ut(e);
|
|
3381
3381
|
}
|
|
3382
3382
|
/** Parse stream. */
|
|
3383
3383
|
async parseStream(e, r, n, i) {
|
|
3384
3384
|
return new Promise((o, s) => {
|
|
3385
|
-
let f,
|
|
3386
|
-
const
|
|
3387
|
-
if (
|
|
3388
|
-
|
|
3385
|
+
let f, u, l, h = !1, c = 0, g = !1;
|
|
3386
|
+
const y = () => {
|
|
3387
|
+
if (g) return;
|
|
3388
|
+
g = !0;
|
|
3389
3389
|
const x = f;
|
|
3390
|
-
f = void 0,
|
|
3391
|
-
|
|
3392
|
-
}),
|
|
3390
|
+
f = void 0, l = void 0, x != null && (this.ignoreErrors(() => x.removeAllListeners()), this.ignoreErrors(() => x.end())), this.ignoreErrors(() => {
|
|
3391
|
+
u?.cancel();
|
|
3392
|
+
}), u = void 0;
|
|
3393
3393
|
}, O = (x) => {
|
|
3394
|
-
h || (
|
|
3394
|
+
h || (h = !0, y(), i.signal.aborted || i.abort(x), s(x));
|
|
3395
3395
|
};
|
|
3396
|
-
i.signal.addEventListener("abort",
|
|
3397
|
-
f =
|
|
3396
|
+
i.signal.addEventListener("abort", y, { once: !0 }), (async () => {
|
|
3397
|
+
f = ut(e), l = this.constructRowBuffer({ chunk: () => {
|
|
3398
|
+
}, chunkSize: r.chunkSize ?? Qn }), f.on("readable", () => {
|
|
3398
3399
|
try {
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3400
|
+
const m = c;
|
|
3401
|
+
if (f == null || l == null) return;
|
|
3402
|
+
let _;
|
|
3403
|
+
for (; (_ = f.read()) != null; ) {
|
|
3402
3404
|
if (c++, h) return;
|
|
3403
|
-
i.signal.throwIfAborted(),
|
|
3405
|
+
i.signal.throwIfAborted(), l.push(_);
|
|
3404
3406
|
}
|
|
3405
|
-
console.log(3333, c);
|
|
3406
|
-
} catch (
|
|
3407
|
-
O(
|
|
3407
|
+
console.log(3333, c - m);
|
|
3408
|
+
} catch (m) {
|
|
3409
|
+
O(m);
|
|
3408
3410
|
}
|
|
3409
|
-
}), f.on("error", (
|
|
3410
|
-
h || (
|
|
3411
|
+
}), f.on("error", (m) => O(m)), f.on("end", () => {
|
|
3412
|
+
h || (l?.flush(), o(this.constructSummary(f)));
|
|
3411
3413
|
});
|
|
3412
3414
|
const x = await fetch(encodeURI(n), { signal: i.signal });
|
|
3413
3415
|
if (!x.ok || x.body == null)
|
|
3414
3416
|
throw await Yn(x, `Failed to fetch '${n}' file.`, "datapos-connector-file-store-emulator|Connector|retrieve");
|
|
3415
|
-
|
|
3416
|
-
let S = await
|
|
3417
|
+
u = x.body.pipeThrough(new TextDecoderStream(r.encodingId)).getReader();
|
|
3418
|
+
let S = await u.read();
|
|
3417
3419
|
for (; !S.done; ) {
|
|
3418
|
-
if (
|
|
3419
|
-
console.log(1111
|
|
3420
|
+
if (h) return;
|
|
3421
|
+
i.signal.throwIfAborted(), console.log(1111, S.value.length), await this.writeToParser(f, S.value), S = await u.read();
|
|
3420
3422
|
}
|
|
3421
3423
|
f.end();
|
|
3422
3424
|
})().catch((x) => O(x));
|
|
3423
3425
|
});
|
|
3424
3426
|
}
|
|
3427
|
+
/** Write to parser. */
|
|
3428
|
+
writeToParser(e, r) {
|
|
3429
|
+
return new Promise((n, i) => {
|
|
3430
|
+
e.write(r, (o) => {
|
|
3431
|
+
o ? i(o) : n();
|
|
3432
|
+
});
|
|
3433
|
+
});
|
|
3434
|
+
}
|
|
3425
3435
|
/** Parse string. */
|
|
3426
3436
|
parseString() {
|
|
3427
3437
|
}
|
|
@@ -3446,14 +3456,6 @@ class Gn {
|
|
|
3446
3456
|
recordCount: e?.info.records ?? -1
|
|
3447
3457
|
};
|
|
3448
3458
|
}
|
|
3449
|
-
/** Write to parser. */
|
|
3450
|
-
writeToParser(e, r) {
|
|
3451
|
-
return new Promise((n, i) => {
|
|
3452
|
-
e.write(r, (o) => {
|
|
3453
|
-
o ? i(o) : n();
|
|
3454
|
-
});
|
|
3455
|
-
});
|
|
3456
|
-
}
|
|
3457
3459
|
/** Ignore best-effort cleanup errors to keep teardown noise-free. */
|
|
3458
3460
|
ignoreErrors(e) {
|
|
3459
3461
|
try {
|
|
@@ -6,14 +6,14 @@ declare class Tool {
|
|
|
6
6
|
buildParser(options: ParseOptions): Parser;
|
|
7
7
|
/** Parse stream. */
|
|
8
8
|
parseStream(parseOptions: ParseOptions, retrieveRecordsOptions: RetrieveRecordsOptions, url: string, abortController: AbortController): Promise<RetrieveRecordsSummary>;
|
|
9
|
+
/** Write to parser. */
|
|
10
|
+
private writeToParser;
|
|
9
11
|
/** Parse string. */
|
|
10
12
|
parseString(): void;
|
|
11
13
|
/** Construct row buffer. */
|
|
12
14
|
private constructRowBuffer;
|
|
13
15
|
/** Construct summary. */
|
|
14
16
|
private constructSummary;
|
|
15
|
-
/** Write to parser. */
|
|
16
|
-
private writeToParser;
|
|
17
17
|
/** Ignore best-effort cleanup errors to keep teardown noise-free. */
|
|
18
18
|
private ignoreErrors;
|
|
19
19
|
}
|