Say I have the following 2 objects:
obj1 = {
dataId: 1,
item: {}
}
obj2 = {
id: 1,
data: { a: 1, b: 2, c: 3 }
}
I then have 2 observables that hold arrays of objects of the above types:
Observable<obj1[]>
Observable<obj2[]>
Is there a way using rxjs to merge the 2 observables into a new observable where if the Ids are equal to each other then the data of obj2 is mapped to the item field in object 1? So going of the objects above, results in an observable with this object:
newObj = {
id: 1,
item: { a: 1, b: 2, c: 3 }
}
The second observable will always contain a matching id for the first observables dataId field, and there may be many dataIds of the same value but the ids in the second observable will always be unique.