import { DEFAULT_DELIMITER, DEFAULT_QUOTATION } from '../../../core/constants'; import { CommonOptions, CSVRecord, PickCSVHeader } from '../../../core/types'; /** * Parse CSV string to record of arrays using WebAssembly (synchronous). * * @param csv - CSV string to parse * @param options - Parse options * @param wasmPool - Optional WASM pool for custom instance management * @returns Record of arrays * * @remarks * This function uses WebAssembly to parse CSV string synchronously. * * **WASM Initialization:** * WASM module is automatically initialized on first use. * However, it is recommended to call {@link loadWASM} beforehand for better performance. * * ```ts * // Recommended: Initialize WASM beforehand * import { loadWASM, parseStringToArraySyncWASM } from 'web-csv-toolbox'; * await loadWASM(); * const result = parseStringToArraySyncWASM(csv); * ``` * * ```ts * // Alternative: Automatic initialization (works but slower on first use) * import { parseStringToArraySyncWASM } from 'web-csv-toolbox'; * const result = parseStringToArraySyncWASM(csv); * ``` * * **Performance Characteristics:** * - **Execution**: Synchronous operation that blocks the calling thread * - **Memory usage**: O(n) - loads entire result into memory * - **Use case**: Suitable when you need synchronous parsing and can accept blocking behavior * * **Limitations:** * - Only supports UTF-8 string (not UTF-16) * - Only supports double quote (`"`) as quotation character * - Only supports single character as delimiter * - WASM is automatically initialized on first use (optional preloading via {@link loadWASM} improves first-parse performance) * * @example Recommended usage with loadWASM * ```ts * import { loadWASM, parseStringToArraySyncWASM } from "web-csv-toolbox"; * * // Recommended: Load WASM beforehand * await loadWASM(); * * const csv = "a,b,c\n1,2,3"; * const result = parseStringToArraySyncWASM(csv); * console.log(result); * // Prints: [{ a: "1", b: "2", c: "3" }] * ``` * * @example Alternative: automatic initialization (slower on first use) * ```ts * import { parseStringToArraySyncWASM } from "web-csv-toolbox"; * * // WASM is automatically initialized on first use * const result = parseStringToArraySyncWASM(csv); * ``` * * @beta * @throws {RangeError} If provided options are invalid or WASM module initialization fails * @throws {TypeError} If provided options have invalid types */ export declare function parseStringToArraySyncWASM = PickCSVHeader>(csv: CSVSource, options: CommonOptions): CSVRecord
[]; export declare function parseStringToArraySyncWASM = PickCSVHeader>(csv: CSVSource, options?: CommonOptions): CSVRecord
[]; export declare function parseStringToArraySyncWASM, const Delimiter extends string = DEFAULT_DELIMITER, const Quotation extends string = DEFAULT_QUOTATION>(csv: string, options?: CommonOptions): CSVRecord
[];