Creates a new object by cloning the original and applying partial updates. This function follows immutable update patterns, ensuring the original object remains unchanged.
The type of the object being evolved
The original object to be cloned
Partial attributes to update on the new object
A new object with the original properties and specified updates applied
// Basic usageconst user = { name: 'Alice', age: 30 };const updatedUser = evolve(user, { age: 31 });// Result: { name: 'Alice', age: 31 }// Original user object remains { name: 'Alice', age: 30 } Copy
// Basic usageconst user = { name: 'Alice', age: 30 };const updatedUser = evolve(user, { age: 31 });// Result: { name: 'Alice', age: 31 }// Original user object remains { name: 'Alice', age: 30 }
Creates a new object by cloning the original and applying partial updates. This function follows immutable update patterns, ensuring the original object remains unchanged.