Function Graph Overview
    Preparing search index...

    Function evolve

    • Creates a new object by cloning the original and applying partial updates. This function follows immutable update patterns, ensuring the original object remains unchanged.

      Type Parameters

      • T extends object

        The type of the object being evolved

      Parameters

      • obj: T

        The original object to be cloned

      • attrs: Partial<T>

        Partial attributes to update on the new object

      Returns T

      A new object with the original properties and specified updates applied

      // Basic usage
      const user = { name: 'Alice', age: 30 };
      const updatedUser = evolve(user, { age: 31 });
      // Result: { name: 'Alice', age: 31 }
      // Original user object remains { name: 'Alice', age: 30 }