@datapos/datapos-tool-csv-parse 0.0.18 → 0.0.19

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.
@@ -532,79 +532,79 @@ a.prototype.slice = function(e, r) {
532
532
  }
533
533
  return i;
534
534
  };
535
- function C(t, e, r) {
535
+ function O(t, e, r) {
536
536
  if (t % 1 !== 0 || t < 0) throw new RangeError("offset is not uint");
537
537
  if (t + e > r) throw new RangeError("Trying to access beyond buffer length");
538
538
  }
539
539
  a.prototype.readUIntLE = function(e, r, n) {
540
- e = e | 0, r = r | 0, n || C(e, r, this.length);
540
+ e = e | 0, r = r | 0, n || O(e, r, this.length);
541
541
  for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256); )
542
542
  i += this[e + s] * o;
543
543
  return i;
544
544
  };
545
545
  a.prototype.readUIntBE = function(e, r, n) {
546
- e = e | 0, r = r | 0, n || C(e, r, this.length);
546
+ e = e | 0, r = r | 0, n || O(e, r, this.length);
547
547
  for (var i = this[e + --r], o = 1; r > 0 && (o *= 256); )
548
548
  i += this[e + --r] * o;
549
549
  return i;
550
550
  };
551
551
  a.prototype.readUInt8 = function(e, r) {
552
- return r || C(e, 1, this.length), this[e];
552
+ return r || O(e, 1, this.length), this[e];
553
553
  };
554
554
  a.prototype.readUInt16LE = function(e, r) {
555
- return r || C(e, 2, this.length), this[e] | this[e + 1] << 8;
555
+ return r || O(e, 2, this.length), this[e] | this[e + 1] << 8;
556
556
  };
557
557
  a.prototype.readUInt16BE = function(e, r) {
558
- return r || C(e, 2, this.length), this[e] << 8 | this[e + 1];
558
+ return r || O(e, 2, this.length), this[e] << 8 | this[e + 1];
559
559
  };
560
560
  a.prototype.readUInt32LE = function(e, r) {
561
- return r || C(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
561
+ return r || O(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
562
562
  };
563
563
  a.prototype.readUInt32BE = function(e, r) {
564
- return r || C(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
564
+ return r || O(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
565
565
  };
566
566
  a.prototype.readIntLE = function(e, r, n) {
567
- e = e | 0, r = r | 0, n || C(e, r, this.length);
567
+ e = e | 0, r = r | 0, n || O(e, r, this.length);
568
568
  for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256); )
569
569
  i += this[e + s] * o;
570
570
  return o *= 128, i >= o && (i -= Math.pow(2, 8 * r)), i;
571
571
  };
572
572
  a.prototype.readIntBE = function(e, r, n) {
573
- e = e | 0, r = r | 0, n || C(e, r, this.length);
573
+ e = e | 0, r = r | 0, n || O(e, r, this.length);
574
574
  for (var i = r, o = 1, s = this[e + --i]; i > 0 && (o *= 256); )
575
575
  s += this[e + --i] * o;
576
576
  return o *= 128, s >= o && (s -= Math.pow(2, 8 * r)), s;
577
577
  };
578
578
  a.prototype.readInt8 = function(e, r) {
579
- return r || C(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
579
+ return r || O(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
580
580
  };
581
581
  a.prototype.readInt16LE = function(e, r) {
582
- r || C(e, 2, this.length);
582
+ r || O(e, 2, this.length);
583
583
  var n = this[e] | this[e + 1] << 8;
584
584
  return n & 32768 ? n | 4294901760 : n;
585
585
  };
586
586
  a.prototype.readInt16BE = function(e, r) {
587
- r || C(e, 2, this.length);
587
+ r || O(e, 2, this.length);
588
588
  var n = this[e + 1] | this[e] << 8;
589
589
  return n & 32768 ? n | 4294901760 : n;
590
590
  };
591
591
  a.prototype.readInt32LE = function(e, r) {
592
- return r || C(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
592
+ return r || O(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
593
593
  };
594
594
  a.prototype.readInt32BE = function(e, r) {
595
- return r || C(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
595
+ return r || O(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
596
596
  };
597
597
  a.prototype.readFloatLE = function(e, r) {
598
- return r || C(e, 4, this.length), be(this, e, !0, 23, 4);
598
+ return r || O(e, 4, this.length), be(this, e, !0, 23, 4);
599
599
  };
600
600
  a.prototype.readFloatBE = function(e, r) {
601
- return r || C(e, 4, this.length), be(this, e, !1, 23, 4);
601
+ return r || O(e, 4, this.length), be(this, e, !1, 23, 4);
602
602
  };
603
603
  a.prototype.readDoubleLE = function(e, r) {
604
- return r || C(e, 8, this.length), be(this, e, !0, 52, 8);
604
+ return r || O(e, 8, this.length), be(this, e, !0, 52, 8);
605
605
  };
606
606
  a.prototype.readDoubleBE = function(e, r) {
607
- return r || C(e, 8, this.length), be(this, e, !1, 52, 8);
607
+ return r || O(e, 8, this.length), be(this, e, !1, 52, 8);
608
608
  };
609
609
  function N(t, e, r, n, i, o) {
610
610
  if (!$(t)) throw new TypeError('"buffer" argument must be a Buffer instance');
@@ -855,7 +855,7 @@ function xt(t) {
855
855
  function Sr(t) {
856
856
  return typeof t.readFloatLE == "function" && typeof t.slice == "function" && xt(t.slice(0, 0));
857
857
  }
858
- var Oe;
858
+ var Ce;
859
859
  function Q() {
860
860
  }
861
861
  Q.prototype = /* @__PURE__ */ Object.create(null);
@@ -869,7 +869,7 @@ m.prototype._events = void 0;
869
869
  m.prototype._maxListeners = void 0;
870
870
  m.defaultMaxListeners = 10;
871
871
  m.init = function() {
872
- this.domain = null, m.usingDomains && Oe.active && !(this instanceof Oe.Domain) && (this.domain = Oe.active), (!this._events || this._events === Object.getPrototypeOf(this)._events) && (this._events = new Q(), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
872
+ this.domain = null, m.usingDomains && Ce.active && !(this instanceof Ce.Domain) && (this.domain = Ce.active), (!this._events || this._events === Object.getPrototypeOf(this)._events) && (this._events = new Q(), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
873
873
  };
874
874
  m.prototype.setMaxListeners = function(e) {
875
875
  if (typeof e != "number" || e < 0 || isNaN(e))
@@ -896,14 +896,14 @@ function Ir(t, e, r, n) {
896
896
  for (var i = t.length, o = ae(t, i), s = 0; s < i; ++s)
897
897
  o[s].call(r, n);
898
898
  }
899
- function Or(t, e, r, n, i) {
899
+ function Cr(t, e, r, n, i) {
900
900
  if (e)
901
901
  t.call(r, n, i);
902
902
  else
903
903
  for (var o = t.length, s = ae(t, o), f = 0; f < o; ++f)
904
904
  s[f].call(r, n, i);
905
905
  }
906
- function Cr(t, e, r, n, i, o) {
906
+ function Or(t, e, r, n, i, o) {
907
907
  if (e)
908
908
  t.call(r, n, i, o);
909
909
  else
@@ -946,10 +946,10 @@ m.prototype.emit = function(e) {
946
946
  Ir(n, c, this, arguments[1]);
947
947
  break;
948
948
  case 3:
949
- Or(n, c, this, arguments[1], arguments[2]);
949
+ Cr(n, c, this, arguments[1], arguments[2]);
950
950
  break;
951
951
  case 4:
952
- Cr(n, c, this, arguments[1], arguments[2], arguments[3]);
952
+ Or(n, c, this, arguments[1], arguments[2], arguments[3]);
953
953
  break;
954
954
  // slower
955
955
  default:
@@ -1055,10 +1055,10 @@ m.prototype.listeners = function(e) {
1055
1055
  return i ? (r = i[e], r ? typeof r == "function" ? n = [r.listener || r] : n = Nr(r) : n = []) : n = [], n;
1056
1056
  };
1057
1057
  m.listenerCount = function(t, e) {
1058
- return typeof t.listenerCount == "function" ? t.listenerCount(e) : Ot.call(t, e);
1058
+ return typeof t.listenerCount == "function" ? t.listenerCount(e) : Ct.call(t, e);
1059
1059
  };
1060
- m.prototype.listenerCount = Ot;
1061
- function Ot(t) {
1060
+ m.prototype.listenerCount = Ct;
1061
+ function Ct(t) {
1062
1062
  var e = this._events;
1063
1063
  if (e) {
1064
1064
  var r = e[t];
@@ -1087,19 +1087,19 @@ function Nr(t) {
1087
1087
  e[r] = t[r].listener || t[r];
1088
1088
  return e;
1089
1089
  }
1090
- function Ct() {
1090
+ function Ot() {
1091
1091
  throw new Error("setTimeout has not been defined");
1092
1092
  }
1093
1093
  function Tt() {
1094
1094
  throw new Error("clearTimeout has not been defined");
1095
1095
  }
1096
- var Y = Ct, W = Tt;
1096
+ var Y = Ot, W = Tt;
1097
1097
  typeof ie.setTimeout == "function" && (Y = setTimeout);
1098
1098
  typeof ie.clearTimeout == "function" && (W = clearTimeout);
1099
1099
  function At(t) {
1100
1100
  if (Y === setTimeout)
1101
1101
  return setTimeout(t, 0);
1102
- if ((Y === Ct || !Y) && setTimeout)
1102
+ if ((Y === Ot || !Y) && setTimeout)
1103
1103
  return Y = setTimeout, setTimeout(t, 0);
1104
1104
  try {
1105
1105
  return Y(t, 0);
@@ -1221,10 +1221,10 @@ function Dt(t, e) {
1221
1221
  }
1222
1222
  return n;
1223
1223
  }
1224
- var pe = {}, Ce;
1224
+ var pe = {}, Oe;
1225
1225
  function kr(t) {
1226
- if (H(Ce) && (Ce = ge.env.NODE_DEBUG || ""), t = t.toUpperCase(), !pe[t])
1227
- if (new RegExp("\\b" + t + "\\b", "i").test(Ce)) {
1226
+ if (H(Oe) && (Oe = ge.env.NODE_DEBUG || ""), t = t.toUpperCase(), !pe[t])
1227
+ if (new RegExp("\\b" + t + "\\b", "i").test(Oe)) {
1228
1228
  var e = 0;
1229
1229
  pe[t] = function() {
1230
1230
  var r = Ur.apply(null, arguments);
@@ -1974,7 +1974,7 @@ T.prototype._write = function(t, e, r) {
1974
1974
  T.prototype._writev = null;
1975
1975
  T.prototype.end = function(t, e, r) {
1976
1976
  var n = this._writableState;
1977
- typeof t == "function" ? (r = t, t = null, e = null) : typeof e == "function" && (r = e, e = null), t != null && this.write(t, e), n.corked && (n.corked = 1, this.uncork()), !n.ending && !n.finished && On(this, n, r);
1977
+ typeof t == "function" ? (r = t, t = null, e = null) : typeof e == "function" && (r = e, e = null), t != null && this.write(t, e), n.corked && (n.corked = 1, this.uncork()), !n.ending && !n.finished && Cn(this, n, r);
1978
1978
  };
1979
1979
  function jt(t) {
1980
1980
  return t.ending && t.length === 0 && t.bufferedRequest === null && !t.finished && !t.writing;
@@ -1986,7 +1986,7 @@ function qt(t, e) {
1986
1986
  var r = jt(e);
1987
1987
  return r && (e.pendingcb === 0 ? (nt(t, e), e.finished = !0, t.emit("finish")) : nt(t, e)), r;
1988
1988
  }
1989
- function On(t, e, r) {
1989
+ function Cn(t, e, r) {
1990
1990
  e.ending = !0, qt(t, e), r && (e.finished ? B(r) : t.once("finish", r)), e.ended = !0, t.writable = !1;
1991
1991
  }
1992
1992
  function zt(t) {
@@ -2008,9 +2008,9 @@ 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
- S.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", Cn);
2011
+ S.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
- function Cn() {
2013
+ function On() {
2014
2014
  this.allowHalfOpen || this._writableState.ended || B(Tn, this);
2015
2015
  }
2016
2016
  function Tn(t) {
@@ -2725,8 +2725,8 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
2725
2725
  ...this.original_options,
2726
2726
  encoding: I
2727
2727
  });
2728
- for (const O in ce)
2729
- this.options[O] = ce[O];
2728
+ for (const C in ce)
2729
+ this.options[C] = ce[C];
2730
2730
  ({ comment: w, escape: A, quote: U } = this.options);
2731
2731
  break;
2732
2732
  }
@@ -2759,14 +2759,14 @@ 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(y, d))
2761
2761
  if (this.state.quoting === !0) {
2762
- const O = y[d + U.length], Z = E && this.__isCharTrimable(y, d + U.length), j = w !== null && this.__compareBytes(w, y, d + U.length, O), X = this.__isDelimiter(
2762
+ const C = y[d + U.length], Z = E && this.__isCharTrimable(y, d + U.length), j = w !== null && this.__compareBytes(w, y, d + U.length, C), X = this.__isDelimiter(
2763
2763
  y,
2764
2764
  d + U.length,
2765
- O
2766
- ), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(y, d + U.length) : this.__isRecordDelimiter(O, y, d + U.length);
2765
+ C
2766
+ ), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(y, d + U.length) : this.__isRecordDelimiter(C, y, d + U.length);
2767
2767
  if (A !== null && this.__isEscape(y, d, I) && this.__isQuote(y, d + A.length))
2768
2768
  d += A.length - 1;
2769
- else if (!O || X || de || j || Z) {
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
2772
  } else if (x === !1) {
@@ -2775,7 +2775,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
2775
2775
  "CSV_INVALID_CLOSING_QUOTE",
2776
2776
  [
2777
2777
  "Invalid Closing Quote:",
2778
- `got "${String.fromCharCode(O)}"`,
2778
+ `got "${String.fromCharCode(C)}"`,
2779
2779
  `at line ${this.info.lines}`,
2780
2780
  "instead of delimiter, record delimiter, trimable character",
2781
2781
  "(if activated) or comment"
@@ -2789,18 +2789,18 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
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
2791
  if (x === !1) {
2792
- const O = this.__infoField(), Z = Object.keys(re).map(
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
2795
  new _(
2796
2796
  "INVALID_OPENING_QUOTE",
2797
2797
  [
2798
2798
  "Invalid Opening Quote:",
2799
- `a quote is found on field ${JSON.stringify(O.column)} at line ${O.lines}, value is ${JSON.stringify(this.state.field.toString(l))}`,
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,
2803
- O,
2803
+ C,
2804
2804
  {
2805
2805
  field: this.state.field
2806
2806
  }
@@ -2813,27 +2813,27 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
2813
2813
  continue;
2814
2814
  }
2815
2815
  if (this.state.quoting === !1) {
2816
- const O = this.__isRecordDelimiter(
2816
+ const C = this.__isRecordDelimiter(
2817
2817
  I,
2818
2818
  y,
2819
2819
  d
2820
2820
  );
2821
- if (O !== 0) {
2821
+ if (C !== 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(), d += O - 1;
2826
+ this.state.enabled = !0, this.__resetField(), this.__resetRecord(), d += C - 1;
2827
2827
  continue;
2828
2828
  }
2829
2829
  if (D === !0 && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0) {
2830
- this.info.empty_lines++, d += O - 1;
2830
+ this.info.empty_lines++, d += C - 1;
2831
2831
  continue;
2832
2832
  }
2833
2833
  this.info.bytes = this.state.bufBytesStart + d;
2834
2834
  const X = this.__onField();
2835
2835
  if (X !== void 0) return X;
2836
- this.info.bytes = this.state.bufBytesStart + d + O;
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
2839
  if (R !== -1 && this.info.records >= R) {
@@ -2841,7 +2841,7 @@ const Nn = 12, Dn = 13, Fn = 10, Mn = 32, Bn = 9, Un = function(t) {
2841
2841
  return;
2842
2842
  }
2843
2843
  }
2844
- this.state.commenting = !1, d += O - 1;
2844
+ this.state.commenting = !1, d += C - 1;
2845
2845
  continue;
2846
2846
  }
2847
2847
  if (this.state.commenting)
@@ -3386,12 +3386,7 @@ class Gn {
3386
3386
  h || (h = !0, u?.cancel(), l?.flush(), g && f?.destroy(p), o(p));
3387
3387
  };
3388
3388
  try {
3389
- console.log(2222), f = ut(e), l = this.constructRowBuffer({
3390
- chunk: (x) => {
3391
- console.log(x);
3392
- },
3393
- chunkSize: r.chunkSize ?? Qn
3394
- }), f.on("readable", () => {
3389
+ console.log(2222), f = ut(e), l = this.constructRowBuffer({ chunk: r.chunk, chunkSize: r.chunkSize ?? Qn }), f.on("readable", () => {
3395
3390
  try {
3396
3391
  if (f == null || l == null) return;
3397
3392
  let x;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-tool-csv-parse",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "private": false,