web-csv-toolbox
    Preparing search index...

    Function parseStringToArraySyncWASM

    • Beta

      Parse CSV string to record of arrays.

      Type Parameters

      • const CSVSource extends string
      • const Delimiter extends string = ","
      • const Quotation extends string = "\""
      • const Header extends readonly string[] = PickCSVHeader<CSVSource, Delimiter, Quotation>

      Parameters

      Returns CSVRecord<Header>[]

      Record of arrays

      This function uses WebAssembly to parse CSV string. Before calling this function, you must call loadWASM function.

      This function only supports UTF-8 string. If you pass a string that is not UTF-8, like UTF-16, it throws an error. This function only supports double quote as quotation. So, options.quotation must be " (double quote). Otherwise, it throws an error.

      And this function only supports single character as delimiter. So, options.delimiter must be a single character. Otherwise, it throws an error.

      import { loadWASM, parseStringWASM } from "web-csv-toolbox";

      await loadWASM();

      const csv = "a,b,c\n1,2,3";

      const result = parseStringToArraySyncWASM(csv);
      console.log(result);
      // Prints:
      // [{ a: "1", b: "2", c: "3" }]
      • If provided options are invalid.
    • Beta

      Parse CSV string to record of arrays.

      Type Parameters

      • const CSVSource extends string
      • const Delimiter extends string = ","
      • const Quotation extends string = "\""
      • const Header extends readonly string[] = PickCSVHeader<CSVSource>

      Parameters

      Returns CSVRecord<Header>[]

      Record of arrays

      This function uses WebAssembly to parse CSV string. Before calling this function, you must call loadWASM function.

      This function only supports UTF-8 string. If you pass a string that is not UTF-8, like UTF-16, it throws an error. This function only supports double quote as quotation. So, options.quotation must be " (double quote). Otherwise, it throws an error.

      And this function only supports single character as delimiter. So, options.delimiter must be a single character. Otherwise, it throws an error.

      import { loadWASM, parseStringWASM } from "web-csv-toolbox";

      await loadWASM();

      const csv = "a,b,c\n1,2,3";

      const result = parseStringToArraySyncWASM(csv);
      console.log(result);
      // Prints:
      // [{ a: "1", b: "2", c: "3" }]
      • If provided options are invalid.
    • Beta

      Parse CSV string to record of arrays.

      Type Parameters

      • const Header extends readonly string[]
      • const Delimiter extends string = ","
      • const Quotation extends string = "\""

      Parameters

      Returns CSVRecord<Header>[]

      Record of arrays

      This function uses WebAssembly to parse CSV string. Before calling this function, you must call loadWASM function.

      This function only supports UTF-8 string. If you pass a string that is not UTF-8, like UTF-16, it throws an error. This function only supports double quote as quotation. So, options.quotation must be " (double quote). Otherwise, it throws an error.

      And this function only supports single character as delimiter. So, options.delimiter must be a single character. Otherwise, it throws an error.

      import { loadWASM, parseStringWASM } from "web-csv-toolbox";

      await loadWASM();

      const csv = "a,b,c\n1,2,3";

      const result = parseStringToArraySyncWASM(csv);
      console.log(result);
      // Prints:
      // [{ a: "1", b: "2", c: "3" }]
      • If provided options are invalid.