@ai-matrx/records 0.76.14 → 0.76.15

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.
@@ -592,7 +592,7 @@ interface ParsedImport {
592
592
  /** Every row, keyed by heading. Every column is here; nothing is dropped. */
593
593
  rows: Array<Record<string, string>>;
594
594
  }
595
- /** RFC-4180 enough for what the canonical table writes, quotes and embedded newlines included. */
595
+ /** Comma-separated text as rows — THE one reader (kit `parseDelimited`), quotes and embedded newlines included. */
596
596
  declare function parseCsv(text: string): string[][];
597
597
  declare function importCsv(text: string): ParsedImport;
598
598
  declare function importXlsx(bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
@@ -592,7 +592,7 @@ interface ParsedImport {
592
592
  /** Every row, keyed by heading. Every column is here; nothing is dropped. */
593
593
  rows: Array<Record<string, string>>;
594
594
  }
595
- /** RFC-4180 enough for what the canonical table writes, quotes and embedded newlines included. */
595
+ /** Comma-separated text as rows — THE one reader (kit `parseDelimited`), quotes and embedded newlines included. */
596
596
  declare function parseCsv(text: string): string[][];
597
597
  declare function importCsv(text: string): ParsedImport;
598
598
  declare function importXlsx(bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
@@ -9533,7 +9533,7 @@ function predictWriteRefusals(args) {
9533
9533
  }
9534
9534
 
9535
9535
  // src/core/io.ts
9536
- import { toDelimited } from "@ai-matrx/kit/delimited";
9536
+ import { parseDelimited, toDelimited } from "@ai-matrx/kit/delimited";
9537
9537
 
9538
9538
  // src/core/wholeValue.ts
9539
9539
  import { formatFileSize } from "@ai-matrx/kit/format";
@@ -9619,38 +9619,7 @@ async function exportXlsx(fields, rows2, sheetLabel = "Records") {
9619
9619
  return writeWorkbookBytes({ sheets: [{ name, rows: toAoa(fields, rows2) }] });
9620
9620
  }
9621
9621
  function parseCsv(text2) {
9622
- const rows2 = [];
9623
- let row = [];
9624
- let cell = "";
9625
- let quoted = false;
9626
- for (let i = 0; i < text2.length; i += 1) {
9627
- const ch = text2[i];
9628
- if (quoted) {
9629
- if (ch === '"') {
9630
- if (text2[i + 1] === '"') {
9631
- cell += '"';
9632
- i += 1;
9633
- } else quoted = false;
9634
- } else cell += ch;
9635
- continue;
9636
- }
9637
- if (ch === '"') quoted = true;
9638
- else if (ch === ",") {
9639
- row.push(cell);
9640
- cell = "";
9641
- } else if (ch === "\n" || ch === "\r") {
9642
- if (ch === "\r" && text2[i + 1] === "\n") i += 1;
9643
- row.push(cell);
9644
- rows2.push(row);
9645
- row = [];
9646
- cell = "";
9647
- } else cell += ch;
9648
- }
9649
- if (cell.length > 0 || row.length > 0) {
9650
- row.push(cell);
9651
- rows2.push(row);
9652
- }
9653
- return rows2;
9622
+ return parseDelimited(text2, { delimiter: ",", skipEmptyLines: true }).data;
9654
9623
  }
9655
9624
  function importCsv(text2) {
9656
9625
  return fromMatrix(parseCsv(text2));