/** * String utilities for TONL encoding/decoding */ import type { TONLDelimiter } from "../types.js"; /** * Complexity limits for JSON parsing to prevent ReDoS */ interface ComplexityLimits { maxNesting: number; maxProperties: number; maxArrayLength: number; } /** * Safely parse JSON with protection against ReDoS attacks and memory exhaustion * BUG-FIX-004: Now accepts valid JSON primitives (null, true, false, numbers, strings) * @param jsonString - JSON string to parse (objects, arrays, or primitives) * @param limits - Optional complexity limits * @returns Parsed JSON value * @throws Error if JSON is invalid or exceeds limits */ export declare function safeJsonParse(jsonString: string, limits?: Partial): unknown; /** * Check if a value needs quoting based on TONL quoting rules */ export declare function needsQuoting(value: string, delimiter: TONLDelimiter): boolean; /** * Quote a value if needed according to TONL rules */ export declare function quoteIfNeeded(value: string, delimiter: TONLDelimiter): string; /** * Unquote a value, handling backslash-escaped quotes and backslashes */ export declare function unquote(value: string): string; /** * Handle triple-quoted content */ export declare function tripleQuoteIfNeeded(value: string, delimiter: TONLDelimiter): string; /** * Create proper indentation string * BUG-FIX-002: Added validation to prevent string repeat DoS attacks * @param level - Indentation level (must be non-negative safe integer) * @param spaces - Spaces per level (must be 0-100, typically 2 or 4) * @returns Indentation string * @throws RangeError if parameters are invalid or result would be too large */ export declare function makeIndent(level: number, spaces: number): string; export {}; //# sourceMappingURL=strings.d.ts.map