/** * Options for diff generation */ interface DiffOptions { /** * Whether to use colorized output * @default true */ color?: boolean; /** * Only compare object keys/structure (ignore values) * @default false */ keysOnly?: boolean; /** * Output the entire object tree, not just differences * @default false */ full?: boolean; /** * Always include these keys in output for objects with differences * @default [] */ outputKeys?: string[]; /** * Skip these keys when comparing objects * @default [] */ ignoreKeys?: string[]; /** * Ignore value differences, focus only on structure * @default false */ ignoreValues?: boolean; /** * Show similarity info for string changes (Levenshtein) * @default false */ withSimilarity?: boolean; } /** * Enum for diff change types */ declare enum DiffType { ADDED = "added", REMOVED = "removed", CHANGED = "changed", UNCHANGED = "unchanged" } /** * Represents a change between two values */ interface DiffResult { type: DiffType; path?: string[]; oldValue?: SerializableValue; newValue?: SerializableValue; children?: DiffResult[]; /** * Additional metadata about the diff, such as Levenshtein distance metrics */ meta?: { /** Levenshtein distance between strings */ levenDistance?: number; /** Similarity ratio (0-1) where 1 means identical */ similarity?: number; /** Any other metadata properties */ [key: string]: unknown; }; } /** * Type for handling any serializable value */ type SerializableValue = string | number | boolean | null | undefined | { [key: string]: SerializableValue; } | SerializableValue[]; /** * Compare two values and generate a detailed diff result object * * @param oldValue - Original value to compare from * @param newValue - New value to compare against * @param options - Configuration options for the diff * @returns A structured diff result object */ declare function diffRaw(oldValue: SerializableValue, newValue: SerializableValue, options?: DiffOptions): DiffResult; /** * Compare two values and generate a formatted diff string * * @param oldValue - Original value to compare from * @param newValue - New value to compare against * @param options - Configuration options for the diff * @returns A formatted string representation of the diff */ declare function diff(oldValue: SerializableValue, newValue: SerializableValue, options?: DiffOptions): string; /** * Check if two values are different * * @param oldValue - Original value to compare from * @param newValue - New value to compare against * @param options - Configuration options for the diff * @returns A boolean indicating if the values are different */ declare function isDiff(oldValue: SerializableValue, newValue: SerializableValue, options?: DiffOptions): boolean; export { type DiffOptions, type DiffResult, DiffType, type SerializableValue, diff, diffRaw, isDiff };