@datapos/datapos-tool-csv-parse 0.0.24 → 0.0.25
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 +318 -319
- package/dist/types/src/index.d.ts +1 -1
- 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 be(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, w = r ? -1 : 1, p = t[e + c];
|
|
35
|
+
for (c += w, o = p & (1 << -h) - 1, p >>= -h, h += f; h > 0; o = o * 256 + t[e + c], c += w, 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 += w, 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 : (p ? -1 : 1) * (1 / 0);
|
|
44
|
+
s = s + Math.pow(2, n), o = o - l;
|
|
45
45
|
}
|
|
46
|
-
return (
|
|
46
|
+
return (p ? -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, w = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, p = n ? 0 : o - 1, I = n ? 1 : -1, g = 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 += w / u : e += w * 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 + p] = f & 255, p += I, f /= 256, i -= 8)
|
|
51
51
|
;
|
|
52
|
-
for (s = s << i | f,
|
|
52
|
+
for (s = s << i | f, l += i; l > 0; t[r + p] = s & 255, p += I, s /= 256, l -= 8)
|
|
53
53
|
;
|
|
54
|
-
t[r +
|
|
54
|
+
t[r + p - I] |= g * 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(p, I) {
|
|
352
|
+
return o === 1 ? p[I] : p.readUInt16BE(I * 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, w = 0; w < f; w++)
|
|
365
|
+
if (u(t, l + w) !== u(e, w)) {
|
|
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
|
N(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
|
N(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 Or(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 Tr(t, e, r, n) {
|
|
914
914
|
if (e)
|
|
@@ -918,14 +918,14 @@ function Tr(t, e, r, n) {
|
|
|
918
918
|
o[s].apply(r, n);
|
|
919
919
|
}
|
|
920
920
|
m.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 Te(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 (Ae(e) && (
|
|
1315
|
-
return h[0] +
|
|
1314
|
+
if (Ae(e) && (u = " " + RegExp.prototype.toString.call(e)), Xe(e) && (u = " " + Date.prototype.toUTCString.call(e)), Le(e) && (u = " " + Te(e)), o.length === 0 && (!l || e.length == 0))
|
|
1315
|
+
return h[0] + u + h[1];
|
|
1316
1316
|
if (r < 0)
|
|
1317
1317
|
return Ae(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 w;
|
|
1320
|
+
return l ? w = zr(t, e, r, s, o) : w = o.map(function(p) {
|
|
1321
|
+
return ke(t, e, r, s, p, l);
|
|
1322
|
+
}), t.seen.pop(), Vr(w, 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 Ae(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;
|
|
@@ -1565,9 +1565,9 @@ function Zr(t) {
|
|
|
1565
1565
|
function Xr(t) {
|
|
1566
1566
|
this.charReceived = t.length % 3, this.charLength = this.charReceived ? 3 : 0;
|
|
1567
1567
|
}
|
|
1568
|
-
|
|
1569
|
-
var
|
|
1570
|
-
oe(
|
|
1568
|
+
x.ReadableState = Bt;
|
|
1569
|
+
var v = kr("stream");
|
|
1570
|
+
oe(x, m);
|
|
1571
1571
|
function Kr(t, e, r) {
|
|
1572
1572
|
if (typeof t.prependListener == "function")
|
|
1573
1573
|
return t.prependListener(e, r);
|
|
@@ -1579,21 +1579,21 @@ 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
|
-
function
|
|
1585
|
-
if (!(this instanceof
|
|
1584
|
+
function x(t) {
|
|
1585
|
+
if (!(this instanceof x)) return new x(t);
|
|
1586
1586
|
this._readableState = new Bt(t, this), this.readable = !0, t && typeof t.read == "function" && (this._read = t.read), m.call(this);
|
|
1587
1587
|
}
|
|
1588
|
-
|
|
1588
|
+
x.prototype.push = function(t, e) {
|
|
1589
1589
|
var r = this._readableState;
|
|
1590
1590
|
return !r.objectMode && typeof t == "string" && (e = e || r.defaultEncoding, e !== r.encoding && (t = a.from(t, e), e = "")), Ut(this, r, t, e, !1);
|
|
1591
1591
|
};
|
|
1592
|
-
|
|
1592
|
+
x.prototype.unshift = function(t) {
|
|
1593
1593
|
var e = this._readableState;
|
|
1594
1594
|
return Ut(this, e, t, "", !0);
|
|
1595
1595
|
};
|
|
1596
|
-
|
|
1596
|
+
x.prototype.isPaused = function() {
|
|
1597
1597
|
return this._readableState.flowing === !1;
|
|
1598
1598
|
};
|
|
1599
1599
|
function Ut(t, e, r, n, i) {
|
|
@@ -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);
|
|
@@ -1619,8 +1619,8 @@ function Ut(t, e, r, n, i) {
|
|
|
1619
1619
|
function tn(t) {
|
|
1620
1620
|
return !t.ended && (t.needReadable || t.length < t.highWaterMark || t.length === 0);
|
|
1621
1621
|
}
|
|
1622
|
-
|
|
1623
|
-
return this._readableState.decoder = new
|
|
1622
|
+
x.prototype.setEncoding = function(t) {
|
|
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) {
|
|
@@ -1629,15 +1629,15 @@ function rn(t) {
|
|
|
1629
1629
|
function et(t, e) {
|
|
1630
1630
|
return t <= 0 || e.length === 0 && e.ended ? 0 : e.objectMode ? 1 : t !== t ? e.flowing && e.length ? e.buffer.head.data.length : e.length : (t > e.highWaterMark && (e.highWaterMark = rn(t)), t <= e.length ? t : e.ended ? e.length : (e.needReadable = !0, 0));
|
|
1631
1631
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1632
|
+
x.prototype.read = function(t) {
|
|
1633
|
+
v("read", t), t = parseInt(t, 10);
|
|
1634
1634
|
var e = this._readableState, r = t;
|
|
1635
1635
|
if (t !== 0 && (e.emittedReadable = !1), t === 0 && e.needReadable && (e.length >= e.highWaterMark || e.ended))
|
|
1636
|
-
return
|
|
1636
|
+
return v("read: emitReadable", e.length, e.ended), e.length === 0 && e.ended ? De(this) : Se(this), null;
|
|
1637
1637
|
if (t = et(t, e), t === 0 && e.ended)
|
|
1638
1638
|
return e.length === 0 && De(this), null;
|
|
1639
1639
|
var n = e.needReadable;
|
|
1640
|
-
|
|
1640
|
+
v("need readable", n), (e.length === 0 || e.length - t < e.highWaterMark) && (n = !0, v("length less than watermark", n)), e.ended || e.reading ? (n = !1, v("reading or ended", n)) : n && (v("do read"), e.reading = !0, e.sync = !0, e.length === 0 && (e.needReadable = !0), this._read(e.highWaterMark), e.sync = !1, e.reading || (t = et(r, e)));
|
|
1641
1641
|
var i;
|
|
1642
1642
|
return t > 0 ? i = kt(t, e) : i = null, i === null ? (e.needReadable = !0, t = 0) : e.length -= t, e.length === 0 && (e.ended || (e.needReadable = !0), r !== t && e.ended && De(this)), i !== null && this.emit("data", i), i;
|
|
1643
1643
|
};
|
|
@@ -1656,23 +1656,23 @@ function on(t, e) {
|
|
|
1656
1656
|
}
|
|
1657
1657
|
function Se(t) {
|
|
1658
1658
|
var e = t._readableState;
|
|
1659
|
-
e.needReadable = !1, e.emittedReadable || (
|
|
1659
|
+
e.needReadable = !1, e.emittedReadable || (v("emitReadable", e.flowing), e.emittedReadable = !0, e.sync ? B(tt, t) : tt(t));
|
|
1660
1660
|
}
|
|
1661
1661
|
function tt(t) {
|
|
1662
|
-
|
|
1662
|
+
v("emit readable"), t.emit("readable"), Ye(t);
|
|
1663
1663
|
}
|
|
1664
1664
|
function sn(t, e) {
|
|
1665
1665
|
e.readingMore || (e.readingMore = !0, B(fn, t, e));
|
|
1666
1666
|
}
|
|
1667
1667
|
function fn(t, e) {
|
|
1668
|
-
for (var r = e.length; !e.reading && !e.flowing && !e.ended && e.length < e.highWaterMark && (
|
|
1668
|
+
for (var r = e.length; !e.reading && !e.flowing && !e.ended && e.length < e.highWaterMark && (v("maybeReadMore read 0"), t.read(0), r !== e.length); )
|
|
1669
1669
|
r = e.length;
|
|
1670
1670
|
e.readingMore = !1;
|
|
1671
1671
|
}
|
|
1672
|
-
|
|
1672
|
+
x.prototype._read = function(t) {
|
|
1673
1673
|
this.emit("error", new Error("not implemented"));
|
|
1674
1674
|
};
|
|
1675
|
-
|
|
1675
|
+
x.prototype.pipe = function(t, e) {
|
|
1676
1676
|
var r = this, n = this._readableState;
|
|
1677
1677
|
switch (n.pipesCount) {
|
|
1678
1678
|
case 0:
|
|
@@ -1685,52 +1685,52 @@ S.prototype.pipe = function(t, e) {
|
|
|
1685
1685
|
n.pipes.push(t);
|
|
1686
1686
|
break;
|
|
1687
1687
|
}
|
|
1688
|
-
n.pipesCount += 1,
|
|
1688
|
+
n.pipesCount += 1, v("pipe count=%d opts=%j", n.pipesCount, e);
|
|
1689
1689
|
var i = !e || e.end !== !1, o = i ? f : h;
|
|
1690
1690
|
n.endEmitted ? B(o) : r.once("end", o), t.on("unpipe", s);
|
|
1691
|
-
function s(
|
|
1692
|
-
|
|
1691
|
+
function s(S) {
|
|
1692
|
+
v("onunpipe"), S === r && h();
|
|
1693
1693
|
}
|
|
1694
1694
|
function f() {
|
|
1695
|
-
|
|
1695
|
+
v("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
|
-
|
|
1701
|
+
v("cleanup"), t.removeListener("close", I), t.removeListener("finish", g), t.removeListener("drain", u), t.removeListener("error", p), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", h), r.removeListener("data", w), l = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && u();
|
|
1702
1702
|
}
|
|
1703
1703
|
var c = !1;
|
|
1704
|
-
r.on("data",
|
|
1705
|
-
function
|
|
1706
|
-
|
|
1707
|
-
var
|
|
1708
|
-
|
|
1704
|
+
r.on("data", w);
|
|
1705
|
+
function w(S) {
|
|
1706
|
+
v("ondata"), c = !1;
|
|
1707
|
+
var E = t.write(S);
|
|
1708
|
+
E === !1 && !c && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && Pt(n.pipes, t) !== -1) && !l && (v("false write response, pause", r._readableState.awaitDrain), r._readableState.awaitDrain++, c = !0), r.pause());
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1711
|
-
|
|
1710
|
+
function p(S) {
|
|
1711
|
+
v("onerror", S), D(), t.removeListener("error", p), en(t, "error") === 0 && t.emit("error", S);
|
|
1712
1712
|
}
|
|
1713
|
-
Kr(t, "error",
|
|
1714
|
-
function
|
|
1715
|
-
t.removeListener("finish",
|
|
1713
|
+
Kr(t, "error", p);
|
|
1714
|
+
function I() {
|
|
1715
|
+
t.removeListener("finish", g), D();
|
|
1716
1716
|
}
|
|
1717
|
-
t.once("close",
|
|
1718
|
-
function
|
|
1719
|
-
|
|
1717
|
+
t.once("close", I);
|
|
1718
|
+
function g() {
|
|
1719
|
+
v("onfinish"), t.removeListener("close", I), D();
|
|
1720
1720
|
}
|
|
1721
|
-
t.once("finish",
|
|
1721
|
+
t.once("finish", g);
|
|
1722
1722
|
function D() {
|
|
1723
|
-
|
|
1723
|
+
v("unpipe"), r.unpipe(t);
|
|
1724
1724
|
}
|
|
1725
|
-
return t.emit("pipe", r), n.flowing || (
|
|
1725
|
+
return t.emit("pipe", r), n.flowing || (v("pipe resume"), r.resume()), t;
|
|
1726
1726
|
};
|
|
1727
1727
|
function an(t) {
|
|
1728
1728
|
return function() {
|
|
1729
1729
|
var e = t._readableState;
|
|
1730
|
-
|
|
1730
|
+
v("pipeOnDrain", e.awaitDrain), e.awaitDrain && e.awaitDrain--, e.awaitDrain === 0 && t.listeners("data").length && (e.flowing = !0, Ye(t));
|
|
1731
1731
|
};
|
|
1732
1732
|
}
|
|
1733
|
-
|
|
1733
|
+
x.prototype.unpipe = function(t) {
|
|
1734
1734
|
var e = this._readableState;
|
|
1735
1735
|
if (e.pipesCount === 0) return this;
|
|
1736
1736
|
if (e.pipesCount === 1)
|
|
@@ -1745,48 +1745,48 @@ S.prototype.unpipe = function(t) {
|
|
|
1745
1745
|
var o = Pt(e.pipes, t);
|
|
1746
1746
|
return o === -1 ? this : (e.pipes.splice(o, 1), e.pipesCount -= 1, e.pipesCount === 1 && (e.pipes = e.pipes[0]), t.emit("unpipe", this), this);
|
|
1747
1747
|
};
|
|
1748
|
-
|
|
1748
|
+
x.prototype.on = function(t, e) {
|
|
1749
1749
|
var r = m.prototype.on.call(this, t, e);
|
|
1750
1750
|
if (t === "data")
|
|
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
|
-
|
|
1759
|
-
function
|
|
1760
|
-
|
|
1758
|
+
x.prototype.addListener = x.prototype.on;
|
|
1759
|
+
function un(t) {
|
|
1760
|
+
v("readable nexttick read 0"), t.read(0);
|
|
1761
1761
|
}
|
|
1762
|
-
|
|
1762
|
+
x.prototype.resume = function() {
|
|
1763
1763
|
var t = this._readableState;
|
|
1764
|
-
return t.flowing || (
|
|
1764
|
+
return t.flowing || (v("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) {
|
|
1770
|
-
e.reading || (
|
|
1770
|
+
e.reading || (v("resume read 0"), t.read(0)), e.resumeScheduled = !1, e.awaitDrain = 0, t.emit("resume"), Ye(t), e.flowing && !e.reading && t.read(0);
|
|
1771
1771
|
}
|
|
1772
|
-
|
|
1773
|
-
return
|
|
1772
|
+
x.prototype.pause = function() {
|
|
1773
|
+
return v("call pause flowing=%j", this._readableState.flowing), this._readableState.flowing !== !1 && (v("pause"), this._readableState.flowing = !1, this.emit("pause")), this;
|
|
1774
1774
|
};
|
|
1775
1775
|
function Ye(t) {
|
|
1776
1776
|
var e = t._readableState;
|
|
1777
|
-
for (
|
|
1777
|
+
for (v("flow", e.flowing); e.flowing && t.read() !== null; )
|
|
1778
1778
|
;
|
|
1779
1779
|
}
|
|
1780
|
-
|
|
1780
|
+
x.prototype.wrap = function(t) {
|
|
1781
1781
|
var e = this._readableState, r = !1, n = this;
|
|
1782
1782
|
t.on("end", function() {
|
|
1783
|
-
if (
|
|
1783
|
+
if (v("wrapped end"), e.decoder && !e.ended) {
|
|
1784
1784
|
var s = e.decoder.end();
|
|
1785
1785
|
s && s.length && n.push(s);
|
|
1786
1786
|
}
|
|
1787
1787
|
n.push(null);
|
|
1788
1788
|
}), t.on("data", function(s) {
|
|
1789
|
-
if (
|
|
1789
|
+
if (v("wrapped data"), e.decoder && (s = e.decoder.write(s)), !(e.objectMode && s == null) && !(!e.objectMode && (!s || !s.length))) {
|
|
1790
1790
|
var f = n.push(s);
|
|
1791
1791
|
f || (r = !0, t.pause());
|
|
1792
1792
|
}
|
|
@@ -1801,10 +1801,10 @@ S.prototype.wrap = function(t) {
|
|
|
1801
1801
|
return gn(o, function(s) {
|
|
1802
1802
|
t.on(s, n.emit.bind(n, s));
|
|
1803
1803
|
}), n._read = function(s) {
|
|
1804
|
-
|
|
1804
|
+
v("wrapped _read", s), r && (r = !1, t.resume());
|
|
1805
1805
|
}, n;
|
|
1806
1806
|
};
|
|
1807
|
-
|
|
1807
|
+
x._fromList = kt;
|
|
1808
1808
|
function kt(t, e) {
|
|
1809
1809
|
if (e.length === 0) return null;
|
|
1810
1810
|
var r;
|
|
@@ -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);
|
|
@@ -2000,7 +2000,7 @@ function zt(t) {
|
|
|
2000
2000
|
t.corkedRequestsFree ? t.corkedRequestsFree.next = e : t.corkedRequestsFree = e;
|
|
2001
2001
|
};
|
|
2002
2002
|
}
|
|
2003
|
-
oe(M,
|
|
2003
|
+
oe(M, x);
|
|
2004
2004
|
var it = Object.keys(T.prototype);
|
|
2005
2005
|
for (var Fe = 0; Fe < it.length; Fe++) {
|
|
2006
2006
|
var Me = it[Fe];
|
|
@@ -2008,7 +2008,7 @@ for (var Fe = 0; Fe < it.length; Fe++) {
|
|
|
2008
2008
|
}
|
|
2009
2009
|
function M(t) {
|
|
2010
2010
|
if (!(this instanceof M)) return new M(t);
|
|
2011
|
-
|
|
2011
|
+
x.call(this, t), T.call(this, t), t && t.readable === !1 && (this.readable = !1), t && t.writable === !1 && (this.writable = !1), this.allowHalfOpen = !0, t && t.allowHalfOpen === !1 && (this.allowHalfOpen = !1), this.once("end", On);
|
|
2012
2012
|
}
|
|
2013
2013
|
function On() {
|
|
2014
2014
|
this.allowHalfOpen || this._writableState.ended || B(Tn, this);
|
|
@@ -2074,7 +2074,7 @@ fe.prototype._transform = function(t, e, r) {
|
|
|
2074
2074
|
r(null, t);
|
|
2075
2075
|
};
|
|
2076
2076
|
oe(V, m);
|
|
2077
|
-
V.Readable =
|
|
2077
|
+
V.Readable = x;
|
|
2078
2078
|
V.Writable = T;
|
|
2079
2079
|
V.Duplex = M;
|
|
2080
2080
|
V.Transform = k;
|
|
@@ -2100,15 +2100,15 @@ 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(), m.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);
|
|
@@ -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, w = i - n - 1, p = 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,80 +2676,80 @@ 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 w < p;
|
|
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:
|
|
2695
|
-
relax_quotes:
|
|
2696
|
-
rtrim:
|
|
2693
|
+
max_record_size: w,
|
|
2694
|
+
raw: p,
|
|
2695
|
+
relax_quotes: I,
|
|
2696
|
+
rtrim: g,
|
|
2697
2697
|
skip_empty_lines: D,
|
|
2698
|
-
to:
|
|
2699
|
-
to_line:
|
|
2698
|
+
to: S,
|
|
2699
|
+
to_line: E
|
|
2700
2700
|
} = this.options;
|
|
2701
|
-
let { comment:
|
|
2701
|
+
let { comment: y, escape: A, quote: U, record_delimiter: Re } = this.options;
|
|
2702
2702
|
const { bomSkipped: Yt, previousBuf: he, rawBuffer: Wt, escapeIsQuote: Ht } = this.state;
|
|
2703
|
-
let
|
|
2703
|
+
let b;
|
|
2704
2704
|
if (he === void 0)
|
|
2705
2705
|
if (n === void 0) {
|
|
2706
2706
|
s();
|
|
2707
2707
|
return;
|
|
2708
2708
|
} else
|
|
2709
|
-
|
|
2710
|
-
else he !== void 0 && n === void 0 ?
|
|
2709
|
+
b = n;
|
|
2710
|
+
else he !== void 0 && n === void 0 ? b = he : b = a.concat([he, n]);
|
|
2711
2711
|
if (Yt === !1)
|
|
2712
2712
|
if (f === !1)
|
|
2713
2713
|
this.state.bomSkipped = !0;
|
|
2714
|
-
else if (
|
|
2714
|
+
else if (b.length < 3) {
|
|
2715
2715
|
if (i === !1) {
|
|
2716
|
-
this.state.previousBuf =
|
|
2716
|
+
this.state.previousBuf = b;
|
|
2717
2717
|
return;
|
|
2718
2718
|
}
|
|
2719
2719
|
} else {
|
|
2720
|
-
for (const
|
|
2721
|
-
if (re[
|
|
2722
|
-
const J = re[
|
|
2723
|
-
this.state.bufBytesStart += J,
|
|
2720
|
+
for (const R in re)
|
|
2721
|
+
if (re[R].compare(b, 0, re[R].length) === 0) {
|
|
2722
|
+
const J = re[R].length;
|
|
2723
|
+
this.state.bufBytesStart += J, b = b.slice(J);
|
|
2724
2724
|
const ce = ft({
|
|
2725
2725
|
...this.original_options,
|
|
2726
|
-
encoding:
|
|
2726
|
+
encoding: R
|
|
2727
2727
|
});
|
|
2728
2728
|
for (const C in ce)
|
|
2729
2729
|
this.options[C] = ce[C];
|
|
2730
|
-
({ comment:
|
|
2730
|
+
({ comment: y, escape: A, quote: U } = this.options);
|
|
2731
2731
|
break;
|
|
2732
2732
|
}
|
|
2733
2733
|
this.state.bomSkipped = !0;
|
|
2734
2734
|
}
|
|
2735
|
-
const Ie =
|
|
2735
|
+
const Ie = b.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), E !== -1 && this.info.lines > E) {
|
|
2739
2739
|
this.state.stop = !0, s();
|
|
2740
2740
|
return;
|
|
2741
2741
|
}
|
|
2742
2742
|
this.state.quoting === !1 && Re.length === 0 && this.__autoDiscoverRecordDelimiter(
|
|
2743
|
-
|
|
2743
|
+
b,
|
|
2744
2744
|
d
|
|
2745
2745
|
) && (Re = this.options.record_delimiter);
|
|
2746
|
-
const
|
|
2747
|
-
if (
|
|
2746
|
+
const R = b[d];
|
|
2747
|
+
if (p === !0 && Wt.append(R), (R === Pn || R === $n) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0)
|
|
2748
2748
|
this.state.escaping = !1;
|
|
2749
2749
|
else {
|
|
2750
|
-
if (A !== null && this.state.quoting === !0 && this.__isEscape(
|
|
2750
|
+
if (A !== null && this.state.quoting === !0 && this.__isEscape(b, d, R) && d + A.length < Ie)
|
|
2751
2751
|
if (Ht) {
|
|
2752
|
-
if (this.__isQuote(
|
|
2752
|
+
if (this.__isQuote(b, d + A.length)) {
|
|
2753
2753
|
this.state.escaping = !0, d += A.length - 1;
|
|
2754
2754
|
continue;
|
|
2755
2755
|
}
|
|
@@ -2757,19 +2757,19 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2757
2757
|
this.state.escaping = !0, d += A.length - 1;
|
|
2758
2758
|
continue;
|
|
2759
2759
|
}
|
|
2760
|
-
if (this.state.commenting === !1 && this.__isQuote(
|
|
2760
|
+
if (this.state.commenting === !1 && this.__isQuote(b, d))
|
|
2761
2761
|
if (this.state.quoting === !0) {
|
|
2762
|
-
const C =
|
|
2763
|
-
|
|
2762
|
+
const C = b[d + U.length], Z = g && this.__isCharTrimable(b, d + U.length), j = y !== null && this.__compareBytes(y, b, d + U.length, C), X = this.__isDelimiter(
|
|
2763
|
+
b,
|
|
2764
2764
|
d + U.length,
|
|
2765
2765
|
C
|
|
2766
|
-
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(
|
|
2767
|
-
if (A !== null && this.__isEscape(
|
|
2766
|
+
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(b, d + U.length) : this.__isRecordDelimiter(C, b, d + U.length);
|
|
2767
|
+
if (A !== null && this.__isEscape(b, d, R) && this.__isQuote(b, d + A.length))
|
|
2768
2768
|
d += A.length - 1;
|
|
2769
2769
|
else if (!C || X || de || j || Z) {
|
|
2770
2770
|
this.state.quoting = !1, this.state.wasQuoting = !0, d += U.length - 1;
|
|
2771
2771
|
continue;
|
|
2772
|
-
} else if (
|
|
2772
|
+
} else if (I === !1) {
|
|
2773
2773
|
const He = this.__error(
|
|
2774
2774
|
new _(
|
|
2775
2775
|
"CSV_INVALID_CLOSING_QUOTE",
|
|
@@ -2788,7 +2788,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2788
2788
|
} else
|
|
2789
2789
|
this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(U), d += U.length - 1;
|
|
2790
2790
|
} else if (this.state.field.length !== 0) {
|
|
2791
|
-
if (
|
|
2791
|
+
if (I === !1) {
|
|
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(
|
|
@@ -2796,7 +2796,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
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,
|
|
@@ -2814,8 +2814,8 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2814
2814
|
}
|
|
2815
2815
|
if (this.state.quoting === !1) {
|
|
2816
2816
|
const C = this.__isRecordDelimiter(
|
|
2817
|
-
|
|
2818
|
-
|
|
2817
|
+
R,
|
|
2818
|
+
b,
|
|
2819
2819
|
d
|
|
2820
2820
|
);
|
|
2821
2821
|
if (C !== 0) {
|
|
@@ -2836,7 +2836,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2836
2836
|
this.info.bytes = this.state.bufBytesStart + d + C;
|
|
2837
2837
|
const de = this.__onRecord(o);
|
|
2838
2838
|
if (de !== void 0) return de;
|
|
2839
|
-
if (
|
|
2839
|
+
if (S !== -1 && this.info.records >= S) {
|
|
2840
2840
|
this.state.stop = !0, s();
|
|
2841
2841
|
return;
|
|
2842
2842
|
}
|
|
@@ -2846,11 +2846,11 @@ 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 (y !== null && (u === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(y, b, d, R) !== 0) {
|
|
2850
2850
|
this.state.commenting = !0;
|
|
2851
2851
|
continue;
|
|
2852
2852
|
}
|
|
2853
|
-
const Z = this.__isDelimiter(
|
|
2853
|
+
const Z = this.__isDelimiter(b, d, R);
|
|
2854
2854
|
if (Z !== 0) {
|
|
2855
2855
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2856
2856
|
const j = this.__onField();
|
|
@@ -2860,25 +2860,25 @@ 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 && w !== 0 && this.state.record_length + this.state.field.length > w)
|
|
2864
2864
|
return this.__error(
|
|
2865
2865
|
new _(
|
|
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 ${w}`,
|
|
2871
2871
|
`at line ${this.info.lines}`
|
|
2872
2872
|
],
|
|
2873
2873
|
this.options,
|
|
2874
2874
|
this.__infoField()
|
|
2875
2875
|
)
|
|
2876
2876
|
);
|
|
2877
|
-
const J = c === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(
|
|
2877
|
+
const J = c === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(b, d), ce = g === !1 || this.state.wasQuoting === !1;
|
|
2878
2878
|
if (J === !0 && ce === !0)
|
|
2879
|
-
this.state.field.append(
|
|
2879
|
+
this.state.field.append(R);
|
|
2880
2880
|
else {
|
|
2881
|
-
if (
|
|
2881
|
+
if (g === !0 && !this.__isCharTrimable(b, d))
|
|
2882
2882
|
return this.__error(
|
|
2883
2883
|
new _(
|
|
2884
2884
|
"CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",
|
|
@@ -2891,13 +2891,13 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2891
2891
|
this.__infoField()
|
|
2892
2892
|
)
|
|
2893
2893
|
);
|
|
2894
|
-
J === !1 && (d += this.__isCharTrimable(
|
|
2894
|
+
J === !1 && (d += this.__isCharTrimable(b, d) - 1);
|
|
2895
2895
|
continue;
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
2898
2898
|
if (i === !0)
|
|
2899
2899
|
if (this.state.quoting === !0) {
|
|
2900
|
-
const
|
|
2900
|
+
const R = this.__error(
|
|
2901
2901
|
new _(
|
|
2902
2902
|
"CSV_QUOTE_NOT_CLOSED",
|
|
2903
2903
|
[
|
|
@@ -2908,16 +2908,16 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2908
2908
|
this.__infoField()
|
|
2909
2909
|
)
|
|
2910
2910
|
);
|
|
2911
|
-
if (
|
|
2911
|
+
if (R !== void 0) return R;
|
|
2912
2912
|
} else if (this.state.wasQuoting === !0 || this.state.record.length !== 0 || this.state.field.length !== 0) {
|
|
2913
2913
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2914
|
-
const
|
|
2915
|
-
if (
|
|
2914
|
+
const R = this.__onField();
|
|
2915
|
+
if (R !== void 0) return R;
|
|
2916
2916
|
const J = this.__onRecord(o);
|
|
2917
2917
|
if (J !== void 0) return J;
|
|
2918
2918
|
} else this.state.wasRowDelimiter === !0 ? this.info.empty_lines++ : this.state.commenting === !0 && this.info.comment_lines++;
|
|
2919
2919
|
else
|
|
2920
|
-
this.state.bufBytesStart += d, this.state.previousBuf =
|
|
2920
|
+
this.state.bufBytesStart += d, this.state.previousBuf = b.slice(d);
|
|
2921
2921
|
this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1);
|
|
2922
2922
|
},
|
|
2923
2923
|
__onRecord: function(n) {
|
|
@@ -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:
|
|
2935
|
-
} = this.options, { enabled:
|
|
2936
|
-
if (
|
|
2933
|
+
raw: w,
|
|
2934
|
+
skip_records_with_empty_values: p
|
|
2935
|
+
} = this.options, { enabled: I, record: g } = this.state;
|
|
2936
|
+
if (I === !1)
|
|
2937
2937
|
return this.__resetRecord();
|
|
2938
|
-
const D =
|
|
2938
|
+
const D = g.length;
|
|
2939
2939
|
if (i === !0) {
|
|
2940
|
-
if (
|
|
2940
|
+
if (p === !0 && at(g)) {
|
|
2941
2941
|
this.__resetRecord();
|
|
2942
2942
|
return;
|
|
2943
2943
|
}
|
|
2944
|
-
return this.__firstLineToColumns(
|
|
2944
|
+
return this.__firstLineToColumns(g);
|
|
2945
2945
|
}
|
|
2946
2946
|
if (i === !1 && this.info.records === 0 && (this.state.expectedRecordLength = D), D !== this.state.expectedRecordLength) {
|
|
2947
|
-
const
|
|
2947
|
+
const S = i === !1 ? new _(
|
|
2948
2948
|
"CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",
|
|
2949
2949
|
[
|
|
2950
2950
|
"Invalid Record Length:",
|
|
@@ -2954,7 +2954,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2954
2954
|
this.options,
|
|
2955
2955
|
this.__infoField(),
|
|
2956
2956
|
{
|
|
2957
|
-
record:
|
|
2957
|
+
record: g
|
|
2958
2958
|
}
|
|
2959
2959
|
) : new _(
|
|
2960
2960
|
"CSV_RECORD_INCONSISTENT_COLUMNS",
|
|
@@ -2967,17 +2967,17 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2967
2967
|
this.options,
|
|
2968
2968
|
this.__infoField(),
|
|
2969
2969
|
{
|
|
2970
|
-
record:
|
|
2970
|
+
record: g
|
|
2971
2971
|
}
|
|
2972
2972
|
);
|
|
2973
|
-
if (
|
|
2974
|
-
this.info.invalid_field_length++, this.state.error =
|
|
2973
|
+
if (l === !0 || h === !0 && D < this.state.expectedRecordLength || c === !0 && D > this.state.expectedRecordLength)
|
|
2974
|
+
this.info.invalid_field_length++, this.state.error = S;
|
|
2975
2975
|
else {
|
|
2976
|
-
const
|
|
2977
|
-
if (
|
|
2976
|
+
const E = this.__error(S);
|
|
2977
|
+
if (E) return E;
|
|
2978
2978
|
}
|
|
2979
2979
|
}
|
|
2980
|
-
if (
|
|
2980
|
+
if (p === !0 && at(g)) {
|
|
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++,
|
|
2989
|
-
const { objname:
|
|
2988
|
+
if (this.info.records++, u === 1 || this.info.records >= u) {
|
|
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 E = {};
|
|
2992
|
+
for (let y = 0, A = g.length; y < A; y++)
|
|
2993
|
+
i[y] === void 0 || i[y].disabled || (o === !0 && E[i[y].name] !== void 0 ? Array.isArray(E[i[y].name]) ? E[i[y].name] = E[i[y].name].concat(g[y]) : E[i[y].name] = [E[i[y].name], g[y]] : E[i[y].name] = g[y]);
|
|
2994
|
+
if (w === !0 || f === !0) {
|
|
2995
|
+
const y = Object.assign(
|
|
2996
|
+
{ record: E },
|
|
2997
|
+
w === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
2998
2998
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
2999
2999
|
), A = this.__push(
|
|
3000
|
-
|
|
3000
|
+
S === void 0 ? y : [E[S], y],
|
|
3001
3001
|
n
|
|
3002
3002
|
);
|
|
3003
3003
|
if (A)
|
|
3004
3004
|
return A;
|
|
3005
3005
|
} else {
|
|
3006
|
-
const
|
|
3007
|
-
|
|
3006
|
+
const y = this.__push(
|
|
3007
|
+
S === void 0 ? E : [E[S], E],
|
|
3008
3008
|
n
|
|
3009
3009
|
);
|
|
3010
|
-
if (
|
|
3011
|
-
return
|
|
3010
|
+
if (y)
|
|
3011
|
+
return y;
|
|
3012
3012
|
}
|
|
3013
|
-
} else if (
|
|
3014
|
-
const
|
|
3015
|
-
{ record:
|
|
3016
|
-
|
|
3013
|
+
} else if (w === !0 || f === !0) {
|
|
3014
|
+
const E = Object.assign(
|
|
3015
|
+
{ record: g },
|
|
3016
|
+
w === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
3017
3017
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
3018
|
-
),
|
|
3019
|
-
|
|
3018
|
+
), y = this.__push(
|
|
3019
|
+
S === void 0 ? E : [g[S], E],
|
|
3020
3020
|
n
|
|
3021
3021
|
);
|
|
3022
|
-
if (
|
|
3023
|
-
return
|
|
3022
|
+
if (y)
|
|
3023
|
+
return y;
|
|
3024
3024
|
} else {
|
|
3025
|
-
const
|
|
3026
|
-
|
|
3025
|
+
const E = this.__push(
|
|
3026
|
+
S === void 0 ? g : [g[S], g],
|
|
3027
3027
|
n
|
|
3028
3028
|
);
|
|
3029
|
-
if (
|
|
3030
|
-
return
|
|
3029
|
+
if (E)
|
|
3030
|
+
return E;
|
|
3031
3031
|
}
|
|
3032
3032
|
}
|
|
3033
3033
|
this.__resetRecord();
|
|
@@ -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;
|
|
@@ -3377,39 +3377,38 @@ const Qn = 4096;
|
|
|
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
|
-
async parseStream(e, r, n, i
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
}
|
|
3383
|
+
async parseStream(e, r, n, i) {
|
|
3384
|
+
return new Promise((o, s) => {
|
|
3385
|
+
let f, u, l, h = !1;
|
|
3386
|
+
const c = (p) => {
|
|
3387
|
+
h || (h = !0, u?.cancel(), f?.destroy(), s(p));
|
|
3388
|
+
};
|
|
3389
|
+
(async () => {
|
|
3390
|
+
f = ut(e), l = this.constructRowBuffer({ chunk: r.chunk, chunkSize: r.chunkSize ?? Qn }), f.on("readable", () => {
|
|
3391
|
+
try {
|
|
3392
|
+
if (f == null || l == null) return;
|
|
3393
|
+
let g;
|
|
3394
|
+
for (; (g = f.read()) != null; )
|
|
3395
|
+
i.throwIfAborted(), l.push(g);
|
|
3396
|
+
} catch (g) {
|
|
3397
|
+
c(g);
|
|
3398
|
+
}
|
|
3399
|
+
}), f.on("error", (g) => c(g)), f.on("end", () => {
|
|
3400
|
+
h || (l?.flush(), o(this.constructSummary(f)));
|
|
3401
|
+
});
|
|
3402
|
+
const p = await fetch(encodeURI(n), { signal: i });
|
|
3403
|
+
if (!p.ok || p.body == null)
|
|
3404
|
+
throw await Yn(p, `Failed to fetch '${n}' file.`, "datapos-connector-file-store-emulator|Connector|retrieve");
|
|
3405
|
+
u = p.body.pipeThrough(new TextDecoderStream(r.encodingId)).getReader();
|
|
3406
|
+
let I = await u.read();
|
|
3407
|
+
for (; !I.done; )
|
|
3408
|
+
i.throwIfAborted(), await this.writeToParser(f, I.value), I = await u.read();
|
|
3409
|
+
f.end();
|
|
3410
|
+
})().catch((p) => c(p));
|
|
3411
|
+
});
|
|
3413
3412
|
}
|
|
3414
3413
|
/** Parse string. */
|
|
3415
3414
|
parseString() {
|