@datapos/datapos-tool-csv-parse 0.0.93 → 0.0.94
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.
|
@@ -31,8 +31,8 @@ function Ze(t) {
|
|
|
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, a = (1 << f) - 1, l = a >> 1, h = -7, c = r ? i - 1 : 0, d = r ? -1 : 1,
|
|
35
|
-
for (c += d, o =
|
|
34
|
+
var o, s, f = i * 8 - n - 1, a = (1 << f) - 1, l = a >> 1, h = -7, c = r ? i - 1 : 0, d = r ? -1 : 1, p = t[e + c];
|
|
35
|
+
for (c += d, o = p & (1 << -h) - 1, p >>= -h, h += f; h > 0; o = o * 256 + t[e + c], c += d, h -= 8)
|
|
36
36
|
;
|
|
37
37
|
for (s = o & (1 << -h) - 1, o >>= -h, h += n; h > 0; s = s * 256 + t[e + c], c += d, h -= 8)
|
|
38
38
|
;
|
|
@@ -40,18 +40,18 @@ function ve(t, e, r, n, i) {
|
|
|
40
40
|
o = 1 - l;
|
|
41
41
|
else {
|
|
42
42
|
if (o === a)
|
|
43
|
-
return s ? NaN : (
|
|
43
|
+
return s ? NaN : (p ? -1 : 1) * (1 / 0);
|
|
44
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, a, l = o * 8 - i - 1, h = (1 << l) - 1, c = h >> 1, d = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 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 * (a = Math.pow(2, -s)) < 1 && (s--, a *= 2), s + c >= 1 ? e += d / a : e += d * Math.pow(2, 1 - c), e * a >= 2 && (s++, a /= 2), s + c >= h ? (f = 0, s = h) : s + c >= 1 ? (f = (e * a - 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 +
|
|
49
|
+
var s, f, a, l = o * 8 - i - 1, h = (1 << l) - 1, c = h >> 1, d = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, p = n ? 0 : o - 1, x = n ? 1 : -1, _ = 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 * (a = Math.pow(2, -s)) < 1 && (s--, a *= 2), s + c >= 1 ? e += d / a : e += d * Math.pow(2, 1 - c), e * a >= 2 && (s++, a /= 2), s + c >= h ? (f = 0, s = h) : s + c >= 1 ? (f = (e * a - 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 += x, f /= 256, i -= 8)
|
|
51
51
|
;
|
|
52
|
-
for (s = s << i | f, l += i; l > 0; t[r +
|
|
52
|
+
for (s = s << i | f, l += i; l > 0; t[r + p] = s & 255, p += x, s /= 256, l -= 8)
|
|
53
53
|
;
|
|
54
|
-
t[r +
|
|
54
|
+
t[r + p - x] |= _ * 128;
|
|
55
55
|
}
|
|
56
56
|
var er = {}.toString, dt = Array.isArray || function(t) {
|
|
57
57
|
return er.call(t) == "[object Array]";
|
|
@@ -348,8 +348,8 @@ function Xe(t, e, r, n, i) {
|
|
|
348
348
|
return -1;
|
|
349
349
|
o = 2, s /= 2, f /= 2, r /= 2;
|
|
350
350
|
}
|
|
351
|
-
function a(
|
|
352
|
-
return o === 1 ?
|
|
351
|
+
function a(p, x) {
|
|
352
|
+
return o === 1 ? p[x] : p.readUInt16BE(x * o);
|
|
353
353
|
}
|
|
354
354
|
var l;
|
|
355
355
|
if (i) {
|
|
@@ -1317,8 +1317,8 @@ function ye(t, e, r) {
|
|
|
1317
1317
|
return Le(e) ? t.stylize(RegExp.prototype.toString.call(e), "regexp") : t.stylize("[Object]", "special");
|
|
1318
1318
|
t.seen.push(e);
|
|
1319
1319
|
var d;
|
|
1320
|
-
return l ? d = zr(t, e, r, s, o) : d = o.map(function(
|
|
1321
|
-
return Pe(t, e, r, s,
|
|
1320
|
+
return l ? d = zr(t, e, r, s, o) : d = o.map(function(p) {
|
|
1321
|
+
return Pe(t, e, r, s, p, l);
|
|
1322
1322
|
}), t.seen.pop(), Jr(d, a, h);
|
|
1323
1323
|
}
|
|
1324
1324
|
function Vr(t, e) {
|
|
@@ -1698,7 +1698,7 @@ C.prototype.pipe = function(t, e) {
|
|
|
1698
1698
|
t.on("drain", a);
|
|
1699
1699
|
var l = !1;
|
|
1700
1700
|
function h() {
|
|
1701
|
-
E("cleanup"), t.removeListener("close", x), t.removeListener("finish", _), t.removeListener("drain", a), t.removeListener("error",
|
|
1701
|
+
E("cleanup"), t.removeListener("close", x), t.removeListener("finish", _), t.removeListener("drain", a), t.removeListener("error", p), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", h), r.removeListener("data", d), l = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && a();
|
|
1702
1702
|
}
|
|
1703
1703
|
var c = !1;
|
|
1704
1704
|
r.on("data", d);
|
|
@@ -1707,10 +1707,10 @@ C.prototype.pipe = function(t, e) {
|
|
|
1707
1707
|
var v = t.write(I);
|
|
1708
1708
|
v === !1 && !c && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && $t(n.pipes, t) !== -1) && !l && (E("false write response, pause", r._readableState.awaitDrain), r._readableState.awaitDrain++, c = !0), r.pause());
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1711
|
-
E("onerror", I), S(), t.removeListener("error",
|
|
1710
|
+
function p(I) {
|
|
1711
|
+
E("onerror", I), S(), t.removeListener("error", p), tn(t, "error") === 0 && t.emit("error", I);
|
|
1712
1712
|
}
|
|
1713
|
-
en(t, "error",
|
|
1713
|
+
en(t, "error", p);
|
|
1714
1714
|
function x() {
|
|
1715
1715
|
t.removeListener("finish", _), S();
|
|
1716
1716
|
}
|
|
@@ -2665,7 +2665,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2665
2665
|
state: kn(r),
|
|
2666
2666
|
__needMoreData: function(n, i, o) {
|
|
2667
2667
|
if (o) return !1;
|
|
2668
|
-
const { encoding: s, escape: f, quote: a } = this.options, { quoting: l, needMoreDataSize: h, recordDelimiterMaxLength: c } = this.state, d = i - n - 1,
|
|
2668
|
+
const { encoding: s, escape: f, quote: a } = this.options, { quoting: l, needMoreDataSize: h, recordDelimiterMaxLength: c } = this.state, d = 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:
|
|
@@ -2680,7 +2680,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2680
2680
|
// Skip if remaining buffer can be record delimiter following the closing quote
|
|
2681
2681
|
l ? a.length + c : 0
|
|
2682
2682
|
);
|
|
2683
|
-
return d <
|
|
2683
|
+
return d < p;
|
|
2684
2684
|
},
|
|
2685
2685
|
// Central parser implementation
|
|
2686
2686
|
parse: function(n, i, o, s) {
|
|
@@ -2691,7 +2691,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2691
2691
|
from_line: h,
|
|
2692
2692
|
ltrim: c,
|
|
2693
2693
|
max_record_size: d,
|
|
2694
|
-
raw:
|
|
2694
|
+
raw: p,
|
|
2695
2695
|
relax_quotes: x,
|
|
2696
2696
|
rtrim: _,
|
|
2697
2697
|
skip_empty_lines: S,
|
|
@@ -2733,41 +2733,41 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2733
2733
|
this.state.bomSkipped = !0;
|
|
2734
2734
|
}
|
|
2735
2735
|
const Ie = b.length;
|
|
2736
|
-
let
|
|
2737
|
-
for (
|
|
2736
|
+
let g;
|
|
2737
|
+
for (g = 0; g < Ie && !this.__needMoreData(g, Ie, i); g++) {
|
|
2738
2738
|
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1), v !== -1 && this.info.lines > v) {
|
|
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
|
+
g
|
|
2745
2745
|
) && (Re = this.options.record_delimiter);
|
|
2746
|
-
const O = b[
|
|
2747
|
-
if (
|
|
2746
|
+
const O = b[g];
|
|
2747
|
+
if (p === !0 && Qt.append(O), (O === $n || O === jn) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0)
|
|
2748
2748
|
this.state.escaping = !1;
|
|
2749
2749
|
else {
|
|
2750
|
-
if (R !== null && this.state.quoting === !0 && this.__isEscape(b,
|
|
2750
|
+
if (R !== null && this.state.quoting === !0 && this.__isEscape(b, g, O) && g + R.length < Ie)
|
|
2751
2751
|
if (Ht) {
|
|
2752
|
-
if (this.__isQuote(b,
|
|
2753
|
-
this.state.escaping = !0,
|
|
2752
|
+
if (this.__isQuote(b, g + R.length)) {
|
|
2753
|
+
this.state.escaping = !0, g += R.length - 1;
|
|
2754
2754
|
continue;
|
|
2755
2755
|
}
|
|
2756
2756
|
} else {
|
|
2757
|
-
this.state.escaping = !0,
|
|
2757
|
+
this.state.escaping = !0, g += R.length - 1;
|
|
2758
2758
|
continue;
|
|
2759
2759
|
}
|
|
2760
|
-
if (this.state.commenting === !1 && this.__isQuote(b,
|
|
2760
|
+
if (this.state.commenting === !1 && this.__isQuote(b, g))
|
|
2761
2761
|
if (this.state.quoting === !0) {
|
|
2762
|
-
const A = b[
|
|
2762
|
+
const A = b[g + F.length], Z = _ && this.__isCharTrimable(b, g + F.length), j = w !== null && this.__compareBytes(w, b, g + F.length, A), X = this.__isDelimiter(
|
|
2763
2763
|
b,
|
|
2764
|
-
|
|
2764
|
+
g + F.length,
|
|
2765
2765
|
A
|
|
2766
|
-
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(b,
|
|
2767
|
-
if (R !== null && this.__isEscape(b,
|
|
2768
|
-
|
|
2766
|
+
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(b, g + F.length) : this.__isRecordDelimiter(A, b, g + F.length);
|
|
2767
|
+
if (R !== null && this.__isEscape(b, g, O) && this.__isQuote(b, g + R.length))
|
|
2768
|
+
g += R.length - 1;
|
|
2769
2769
|
else if (!A || X || de || j || Z) {
|
|
2770
|
-
this.state.quoting = !1, this.state.wasQuoting = !0,
|
|
2770
|
+
this.state.quoting = !1, this.state.wasQuoting = !0, g += F.length - 1;
|
|
2771
2771
|
continue;
|
|
2772
2772
|
} else if (x === !1) {
|
|
2773
2773
|
const Ge = this.__error(
|
|
@@ -2786,7 +2786,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2786
2786
|
);
|
|
2787
2787
|
if (Ge !== void 0) return Ge;
|
|
2788
2788
|
} else
|
|
2789
|
-
this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(F),
|
|
2789
|
+
this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(F), g += F.length - 1;
|
|
2790
2790
|
} else if (this.state.field.length !== 0) {
|
|
2791
2791
|
if (x === !1) {
|
|
2792
2792
|
const A = this.__infoField(), Z = Object.keys(re).map(
|
|
@@ -2809,31 +2809,31 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2809
2809
|
if (j !== void 0) return j;
|
|
2810
2810
|
}
|
|
2811
2811
|
} else {
|
|
2812
|
-
this.state.quoting = !0,
|
|
2812
|
+
this.state.quoting = !0, g += F.length - 1;
|
|
2813
2813
|
continue;
|
|
2814
2814
|
}
|
|
2815
2815
|
if (this.state.quoting === !1) {
|
|
2816
2816
|
const A = this.__isRecordDelimiter(
|
|
2817
2817
|
O,
|
|
2818
2818
|
b,
|
|
2819
|
-
|
|
2819
|
+
g
|
|
2820
2820
|
);
|
|
2821
2821
|
if (A !== 0) {
|
|
2822
2822
|
if (this.state.commenting && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0)
|
|
2823
2823
|
this.info.comment_lines++;
|
|
2824
2824
|
else {
|
|
2825
2825
|
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >= h) {
|
|
2826
|
-
this.state.enabled = !0, this.__resetField(), this.__resetRecord(),
|
|
2826
|
+
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), g += A - 1;
|
|
2827
2827
|
continue;
|
|
2828
2828
|
}
|
|
2829
2829
|
if (S === !0 && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0) {
|
|
2830
|
-
this.info.empty_lines++,
|
|
2830
|
+
this.info.empty_lines++, g += A - 1;
|
|
2831
2831
|
continue;
|
|
2832
2832
|
}
|
|
2833
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2833
|
+
this.info.bytes = this.state.bufBytesStart + g;
|
|
2834
2834
|
const X = this.__onField();
|
|
2835
2835
|
if (X !== void 0) return X;
|
|
2836
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2836
|
+
this.info.bytes = this.state.bufBytesStart + g + A;
|
|
2837
2837
|
const de = this.__onRecord(o);
|
|
2838
2838
|
if (de !== void 0) return de;
|
|
2839
2839
|
if (I !== -1 && this.info.records >= I) {
|
|
@@ -2841,21 +2841,21 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2841
2841
|
return;
|
|
2842
2842
|
}
|
|
2843
2843
|
}
|
|
2844
|
-
this.state.commenting = !1,
|
|
2844
|
+
this.state.commenting = !1, g += A - 1;
|
|
2845
2845
|
continue;
|
|
2846
2846
|
}
|
|
2847
2847
|
if (this.state.commenting)
|
|
2848
2848
|
continue;
|
|
2849
|
-
if (w !== null && (a === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(w, b,
|
|
2849
|
+
if (w !== null && (a === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(w, b, g, O) !== 0) {
|
|
2850
2850
|
this.state.commenting = !0;
|
|
2851
2851
|
continue;
|
|
2852
2852
|
}
|
|
2853
|
-
const Z = this.__isDelimiter(b,
|
|
2853
|
+
const Z = this.__isDelimiter(b, g, O);
|
|
2854
2854
|
if (Z !== 0) {
|
|
2855
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2855
|
+
this.info.bytes = this.state.bufBytesStart + g;
|
|
2856
2856
|
const j = this.__onField();
|
|
2857
2857
|
if (j !== void 0) return j;
|
|
2858
|
-
|
|
2858
|
+
g += Z - 1;
|
|
2859
2859
|
continue;
|
|
2860
2860
|
}
|
|
2861
2861
|
}
|
|
@@ -2874,11 +2874,11 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2874
2874
|
this.__infoField()
|
|
2875
2875
|
)
|
|
2876
2876
|
);
|
|
2877
|
-
const J = c === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(b,
|
|
2877
|
+
const J = c === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(b, g), he = _ === !1 || this.state.wasQuoting === !1;
|
|
2878
2878
|
if (J === !0 && he === !0)
|
|
2879
2879
|
this.state.field.append(O);
|
|
2880
2880
|
else {
|
|
2881
|
-
if (_ === !0 && !this.__isCharTrimable(b,
|
|
2881
|
+
if (_ === !0 && !this.__isCharTrimable(b, g))
|
|
2882
2882
|
return this.__error(
|
|
2883
2883
|
new y(
|
|
2884
2884
|
"CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",
|
|
@@ -2891,7 +2891,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2891
2891
|
this.__infoField()
|
|
2892
2892
|
)
|
|
2893
2893
|
);
|
|
2894
|
-
J === !1 && (
|
|
2894
|
+
J === !1 && (g += this.__isCharTrimable(b, g) - 1);
|
|
2895
2895
|
continue;
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
@@ -2910,14 +2910,14 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2910
2910
|
);
|
|
2911
2911
|
if (O !== void 0) return O;
|
|
2912
2912
|
} else if (this.state.wasQuoting === !0 || this.state.record.length !== 0 || this.state.field.length !== 0) {
|
|
2913
|
-
this.info.bytes = this.state.bufBytesStart +
|
|
2913
|
+
this.info.bytes = this.state.bufBytesStart + g;
|
|
2914
2914
|
const O = this.__onField();
|
|
2915
2915
|
if (O !== void 0) return O;
|
|
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 +=
|
|
2920
|
+
this.state.bufBytesStart += g, this.state.previousBuf = b.slice(g);
|
|
2921
2921
|
this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1);
|
|
2922
2922
|
},
|
|
2923
2923
|
__onRecord: function(n) {
|
|
@@ -2931,13 +2931,13 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2931
2931
|
relax_column_count_less: h,
|
|
2932
2932
|
relax_column_count_more: c,
|
|
2933
2933
|
raw: d,
|
|
2934
|
-
skip_records_with_empty_values:
|
|
2934
|
+
skip_records_with_empty_values: p
|
|
2935
2935
|
} = this.options, { enabled: x, record: _ } = this.state;
|
|
2936
2936
|
if (x === !1)
|
|
2937
2937
|
return this.__resetRecord();
|
|
2938
2938
|
const S = _.length;
|
|
2939
2939
|
if (i === !0) {
|
|
2940
|
-
if (
|
|
2940
|
+
if (p === !0 && lt(_)) {
|
|
2941
2941
|
this.__resetRecord();
|
|
2942
2942
|
return;
|
|
2943
2943
|
}
|
|
@@ -2977,7 +2977,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2977
2977
|
if (v) return v;
|
|
2978
2978
|
}
|
|
2979
2979
|
}
|
|
2980
|
-
if (
|
|
2980
|
+
if (p === !0 && lt(_)) {
|
|
2981
2981
|
this.__resetRecord();
|
|
2982
2982
|
return;
|
|
2983
2983
|
}
|
|
@@ -3391,22 +3391,25 @@ class ri {
|
|
|
3391
3391
|
async inferSchema(e, r, n) {
|
|
3392
3392
|
const i = Xn(r), { parsingRecords: o, valueDelimiterId: s } = await Kn(r, n), f = [], a = [];
|
|
3393
3393
|
for (const c of o) {
|
|
3394
|
-
const d = e.inferValues(
|
|
3395
|
-
|
|
3394
|
+
const d = e.inferValues(f, c, !0);
|
|
3395
|
+
a.push(d);
|
|
3396
3396
|
}
|
|
3397
3397
|
let l = 0;
|
|
3398
|
-
const h =
|
|
3398
|
+
const h = a[0];
|
|
3399
3399
|
if (h) {
|
|
3400
3400
|
const c = h.length;
|
|
3401
3401
|
for (let d = 0; d < c; d++) {
|
|
3402
|
-
const
|
|
3402
|
+
const p = h[d]?.inferredValue, x = p == null ? `Column ${d}` : String(p), _ = f[d];
|
|
3403
3403
|
_ != null && (_.label = { en: x });
|
|
3404
3404
|
}
|
|
3405
3405
|
l = 1;
|
|
3406
3406
|
}
|
|
3407
|
-
for (let c = l; c <
|
|
3408
|
-
;
|
|
3409
|
-
|
|
3407
|
+
for (let c = l; c < a.length; c++) {
|
|
3408
|
+
const d = a[c] ?? [];
|
|
3409
|
+
for (let p = 0; p < d.length; p++)
|
|
3410
|
+
f[p];
|
|
3411
|
+
}
|
|
3412
|
+
return { recordDelimiterId: i, valueDelimiterId: s, parsingRecords: o, inferenceRecords: a, columnConfigs: f };
|
|
3410
3413
|
}
|
|
3411
3414
|
/**
|
|
3412
3415
|
* Parse stream.
|
|
@@ -3414,7 +3417,7 @@ class ri {
|
|
|
3414
3417
|
async parseStream(e, r, n, i, o) {
|
|
3415
3418
|
return new Promise((s, f) => {
|
|
3416
3419
|
let a, l, h, c = !1, d = !1;
|
|
3417
|
-
const
|
|
3420
|
+
const p = () => {
|
|
3418
3421
|
if (d) return;
|
|
3419
3422
|
d = !0;
|
|
3420
3423
|
const S = a;
|
|
@@ -3422,9 +3425,9 @@ class ri {
|
|
|
3422
3425
|
l?.cancel();
|
|
3423
3426
|
}), l = void 0;
|
|
3424
3427
|
};
|
|
3425
|
-
i.signal.addEventListener("abort",
|
|
3428
|
+
i.signal.addEventListener("abort", p, { once: !0 });
|
|
3426
3429
|
const x = (S) => {
|
|
3427
|
-
c || (c = !0,
|
|
3430
|
+
c || (c = !0, p(), i.signal.aborted || i.abort(S), f(S));
|
|
3428
3431
|
};
|
|
3429
3432
|
(async () => {
|
|
3430
3433
|
a = je({
|
|
@@ -3476,23 +3479,23 @@ async function Kn(t, e) {
|
|
|
3476
3479
|
try {
|
|
3477
3480
|
let f = 0, a, l = 0, h = 0;
|
|
3478
3481
|
const c = je({
|
|
3479
|
-
cast: (d,
|
|
3482
|
+
cast: (d, p) => ({ value: d, wasValueQuoted: p.quoting }),
|
|
3480
3483
|
delimiter: s,
|
|
3481
3484
|
relax_column_count: !0
|
|
3482
3485
|
});
|
|
3483
3486
|
await new Promise((d) => {
|
|
3484
3487
|
try {
|
|
3485
|
-
const
|
|
3488
|
+
const p = [];
|
|
3486
3489
|
c.on("readable", () => {
|
|
3487
3490
|
let x;
|
|
3488
3491
|
for (; (x = c.read()) != null; ) {
|
|
3489
3492
|
l++;
|
|
3490
3493
|
const _ = x.length;
|
|
3491
|
-
a != null && (h += Math.abs(_ - a)), a = _, f += _,
|
|
3494
|
+
a != null && (h += Math.abs(_ - a)), a = _, f += _, p.push(x);
|
|
3492
3495
|
}
|
|
3493
3496
|
}), c.on("error", () => d()), c.on("end", () => {
|
|
3494
3497
|
const x = f / l;
|
|
3495
|
-
(!i || h <= i) && (!n || x > n) && (r = s, n = x, i = h, o = [...
|
|
3498
|
+
(!i || h <= i) && (!n || x > n) && (r = s, n = x, i = h, o = [...p]), d();
|
|
3496
3499
|
}), c.write(t), c.end();
|
|
3497
3500
|
} catch {
|
|
3498
3501
|
d();
|