I am trying to merge two arrays of objects together.
I have presorted the arrays of objects so that they match, I just need to push the properties across each object in both arrays.
I think lodash would give me a cleaner solution than a double for loop, or should I just do a vanilla JS solution?
Example of two arrays:
[
{
provider: 'foo',
title: 'Title1'
},
{
provider: 'bar',
title: 'Title2'
}
]
[
{
all: '0',
novelty: '24'
},
{
all: '4',
novelty: '12'
}
]
It should return:
[
{
provider: 'foo',
title: 'Title1',
all: '0',
novelty: '24'
},
{
provider: 'bar',
title: 'Title2',
all: '4',
novelty: '12'
}
]