How to map fields between the two objects?

Lads Hello.
Tell me how to reassign the fields of one object to corresponding fields of another?
The fact that I want to create a generic component for react to render a progress bar it takes data like this
const nameUnit = {
 1: {
 barName: 'test1',
 barValue: 57
},
 2: {
 barName: 'test2',
 barValue: 90
 },

I have a object like this
tags = {
 0: {
 tagId: 'fdsf',
 tagName: 'gdfg',
 totalUsers: 5435,
 tagValue: 98
}
}

how to obtain the object of these two such
analyticData = {
 0: {
 tagId: 'fdsf',
 barName: 'gdfg',
 totalUsers: 5435,
 barValue: 98
}
}

?
June 14th 19 at 18:31
1 answer
June 14th 19 at 18:33
As I understand barValue, is id and it is compared with the tagValue.
So just take the loop the first object in make the for loop the second object in make the condition that tagValue == barValue and create two new objects analyticData
(Forgive me, fans of the Whip, I'm sure there are more optimal algorithms)

Find more questions by tags JavaScriptReact