woaru
Version:
Universal Project Setup Autopilot - Analyze and automatically configure development tools for ANY programming language
30 lines • 1.05 kB
TypeScript
/**
* Safe JSON Parser Utility
* Provides secure JSON parsing with validation and error handling
*/
export interface SafeJsonOptions {
maxSize?: number;
allowedKeys?: string[];
prohibitedKeys?: string[];
validateFunction?: (obj: unknown) => boolean;
}
/**
* Safely parse JSON with size limits and validation
*/
export declare function safeJsonParse<T = unknown>(jsonString: string, options?: SafeJsonOptions): T | null;
/**
* Safely stringify JSON with size limits
*/
export declare function safeJsonStringify(obj: unknown, options?: {
maxSize?: number;
space?: number;
}): string;
/**
* Validate that an object has expected structure
*/
export declare function validateJsonStructure<T>(obj: unknown, expectedKeys: (keyof T)[], requiredKeys?: (keyof T)[]): obj is T;
/**
* Create a JSON parser with predefined validation rules
*/
export declare function createJsonValidator<T>(expectedKeys: (keyof T)[], requiredKeys?: (keyof T)[]): (jsonString: string) => T | null;
//# sourceMappingURL=safeJsonParser.d.ts.map