Beta
CSV string
Parse options
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" }]
Parse CSV string to record of arrays.