I have an object as follows:
const params1 = { FunctionName: "Foo", Environment: { Variables: { test: "test" } } } And I have another object as follows:
const params2 = { FunctionName: "Bar", Something: "Something", SomethingMore: "SomethingMore", Environment: { Variables: { sample1: "sample1", sample2: "sample2" } } } I just want to append all the environment variables from params2 to param1, so params1 should finally be something like this:
{ FunctionName: "Foo", Environment: { Variables: { test: "test", sample1: "sample1", sample2: "sample2" } } } How can I achieve the same, I am able to do this using the following code,
params.Environment.Variables = { ...params.Environment.Variables, ...oldVars.Environment.Variables } But I have a restriction that I cannot use the spread operator, please help!