Configuration options for deep diff generation

interface DeepDiffConfig {
    includeArrayIndices: boolean;
    includeUnchanged: boolean;
    maxDepth: number;
    maxStringLength: number;
    treatNullAsUndefined: boolean;
    valueFormatter?: ((value, type) => string);
}

Properties

includeArrayIndices: boolean

Whether to include array indices in paths (e.g., "items[0]" vs "items"). Provides more precise change tracking for arrays.

Default

true
includeUnchanged: boolean

Whether to include unchanged paths in the diff results. Useful for seeing the complete structure comparison.

Default

false
maxDepth: number

Maximum depth to traverse in nested objects. Prevents infinite recursion and controls performance.

Default

10
maxStringLength: number

Maximum string length before truncation in formatted output. Helps keep the output readable for large text values.

Default

100
treatNullAsUndefined: boolean

Whether to treat null values as equivalent to undefined. When true, transitions between null and undefined are not considered changes, and null values in the old object are treated as "not present" for new values. Useful for APIs where null and undefined are used interchangeably.

Default

false
valueFormatter?: ((value, type) => string)

Custom value formatter for the formatted output. Allows customization of how values are displayed.

Type declaration

    • (value, type): string
    • Parameters

      • value: any

        The value to format

      • type: string

        The type of the value

      Returns string

Returns

Formatted string representation