I have two objects, one is used to update the other, something like ETL Process.
const currentObject = {
myObject : [
{
'attribute1':'foo1',
'attribute2':'bar1',
'attribute3':'test1'
},
{
'attribute1':'foo2',
'attribute2':'bar2',
'attribute3':'test2'
},
{
'attribute1':'foo3',
'attribute2':'bar3',
'attribute3':'test3'
},
]
}
if the attribute3 value is "test1", then go to the other object and check for the test1 property and replace the currentObject with the new value
const updateObject = {
myObject : {
'test1':'newtest1',
'test2':'newtest2',
'test3':'newtest3'
}
}
update is done on currentObject attribute3 needs to use updateObject property as reference; where currentObject attribute1="test1" should copy data from updateObject test1 so on:
Final value should be like:
const currentObject = {
myObject : [
{
'attribute1':'foo1',
'attribute2':'bar1',
'attribute3':'newtest1'
},
{
'attribute1':'foo2',
'attribute2':'bar2',
'attribute3':'newtest2'
},
{
'attribute1':'foo3',
'attribute2':'bar3',
'attribute3':'newtest3'
}
]
}