@datapos/datapos-tool-csv-parse 0.0.45 → 0.0.47
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.
|
@@ -1704,8 +1704,8 @@ R.prototype.pipe = function(t, e) {
|
|
|
1704
1704
|
r.on("data", g);
|
|
1705
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
1710
|
function y(S) {
|
|
1711
1711
|
b("onerror", S), x(), t.removeListener("error", y), en(t, "error") === 0 && t.emit("error", S);
|
|
@@ -2696,9 +2696,9 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
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
|
}
|
|
@@ -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
|
|
@@ -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
|
}
|
|
@@ -2973,8 +2973,8 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2973
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
2980
|
if (y === !0 && at(E)) {
|
|
@@ -2988,46 +2988,46 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
|
|
|
2988
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[
|
|
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
2994
|
if (g === !0 || f === !0) {
|
|
2995
|
-
const
|
|
2996
|
-
{ record:
|
|
2995
|
+
const _ = Object.assign(
|
|
2996
|
+
{ record: m },
|
|
2997
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
3013
|
} else if (g === !0 || f === !0) {
|
|
3014
|
-
const
|
|
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();
|
|
@@ -3397,17 +3397,18 @@ class Gn {
|
|
|
3397
3397
|
f = ut(e), l = this.constructRowBuffer({ chunk: () => {
|
|
3398
3398
|
}, chunkSize: r.chunkSize ?? Qn }), f.on("readable", () => {
|
|
3399
3399
|
try {
|
|
3400
|
-
const
|
|
3400
|
+
const m = c;
|
|
3401
3401
|
if (f == null || l == null) return;
|
|
3402
|
-
let
|
|
3403
|
-
for (; (
|
|
3402
|
+
let _;
|
|
3403
|
+
for (; (_ = f.read()) != null; ) {
|
|
3404
3404
|
if (c++, h) return;
|
|
3405
|
-
i.signal.throwIfAborted(), l.push(
|
|
3405
|
+
i.signal.throwIfAborted(), l.push(_);
|
|
3406
3406
|
}
|
|
3407
|
-
|
|
3408
|
-
|
|
3407
|
+
console.log("ROWS", c - m);
|
|
3408
|
+
} catch (m) {
|
|
3409
|
+
O(m);
|
|
3409
3410
|
}
|
|
3410
|
-
}), f.on("error", (
|
|
3411
|
+
}), f.on("error", (m) => O(m)), f.on("end", () => {
|
|
3411
3412
|
h || (l?.flush(), o(this.constructSummary(f)));
|
|
3412
3413
|
});
|
|
3413
3414
|
const x = await fetch(encodeURI(n), { signal: i.signal });
|
|
@@ -3417,7 +3418,7 @@ class Gn {
|
|
|
3417
3418
|
let S = await u.read();
|
|
3418
3419
|
for (; !S.done; ) {
|
|
3419
3420
|
if (h) return;
|
|
3420
|
-
i.signal.throwIfAborted(), f.write(S.value), S = await u.read();
|
|
3421
|
+
i.signal.throwIfAborted(), console.log("CHUNK", S.value), f.write(S.value), S = await u.read();
|
|
3421
3422
|
}
|
|
3422
3423
|
h || f.end();
|
|
3423
3424
|
})().catch((x) => O(x));
|