I'm trying to achieve from this array of objects one smaller array of objects with unique key/value pairs. This is the array from which I want to get a group and its value. This is the main array of objects:
let samples = {
{
id: 2,
group: 'picturesWithDescription',
elements: [
{
id: 1
},
{
id: 2
}
]
},
{
id: 3,
group: 'footers',
elements: [
{
id: 1
},
{
id: 2
}
]
},
{
id: 4,
group: 'movies',
elements: [
{
id: 1
},
{
id: 2
}
]
},
{
id: 4,
group: 'movies',
elements: [
{
id: 1
},
{
id: 2
}
]
}
}
And this is something I would like to achieve:
let result = [
{group: 'picturesWithDescription'},
{group: 'footers'},
{group: 'movies'}
]