Open jihu opened 9 months ago
My use case is that I already have an object, and I want to merge another object into it, without getting a new object. Just like Object.assign works. Maybe you could add a option for this, called 'treatFirstObjectAsTarget'.
Example:
const sourceObject = { a: 1, b: 2, c: 3 }; const targetObject = { x: 10, y: 20, z: 30 }; deepMerge(targetObject, sourceObject, { treatFirstObjectAsTarget: true }); console.info(targetObject); // Should print: { x: 10, y: 20, z: 30, a: 1, b: 2, c: 3 };
My use case is that I already have an object, and I want to merge another object into it, without getting a new object. Just like Object.assign works. Maybe you could add a option for this, called 'treatFirstObjectAsTarget'.
Example: