@metreeca/core - v0.9.11
    Preparing search index...

    Function immutable

    • Creates an immutable deep clone.

      Plain objects, arrays, and functions with custom properties are recursively cloned and frozen. Functions without custom properties are returned as-is. Other object types (Date, RegExp, Buffer, etc.) are returned as-is to preserve their functionality.

      Type Parameters

      • T

        The type of the value to be cloned

      Parameters

      • value: T

        The value to make immutable

      Returns T extends Function ? T<T> : Readonly<T>

      A deeply immutable clone of value

      This function does not handle circular references and will cause infinite recursion leading to a stack overflow if the input contains cycles.

      For functions with custom properties, built-in read-only properties (length, name, prototype) are preserved unchanged while custom writable properties are frozen recursively.