UNPKG

zon-format

Version:

ZON: The most token-efficient serialization format for LLMs - beats CSV, TOON, JSON, and all competitors

58 lines (57 loc) 1.3 kB
/** * Helper Utilities for ZON * * Useful functions for working with ZON data */ /** * Calculate the encoded size of data in different formats */ export declare function size(data: any, format?: 'zon' | 'binary' | 'json'): number; /** * Compare sizes across all formats */ export declare function compareFormats(data: any): { zon: number; binary: number; json: number; savings: { zonVsJson: number; binaryVsJson: number; binaryVsZon: number; }; }; /** * Infer a basic schema structure from sample data * Note: Returns a simple object representation, not a full ZonSchema */ export declare function inferSchema(data: any): any; /** * Deep comparison of two values */ export declare function compare(a: any, b: any): { equal: boolean; differences?: Array<{ path: string; valueA: any; valueB: any; }>; }; /** * Analyze data structure complexity */ export declare function analyze(data: any): { depth: number; fieldCount: number; arrayCount: number; objectCount: number; primitiveCount: number; totalNodes: number; types: Set<string>; }; /** * Check if data is safe for ZON encoding */ export declare function isSafe(data: any): { safe: boolean; issues?: string[]; };