• This utility function will copy all scalar and array properties from an object to a new object and return the new object. This function will NOT copy functions or non-plain objects (unless resolveCircularReferences is true).

    Type Parameters

    • T extends object

    Parameters

    • input: T

      The object to copy

    • resolveCircularReferences: boolean = false

      If true, handles circular references and complex objects for safe JSON serialization. When enabled, circular references are replaced with '[Circular Reference]', complex objects (Sockets, Streams, etc.) are replaced with their type names, Error objects are specially handled to extract name/message/stack, and Dates are converted to ISO strings. Default: false

    • maxDepth: number = 10

      Maximum recursion depth when resolveCircularReferences is true (default: 10)

    Returns Partial<T>

    A new object with scalars and arrays copied