k
Size: a a a
k
S
А
AB
k
DM
DM
DM
D
D
DM
AB
DT
DT
const simplaArr = [
{year: '1988', title: 'tile1', location: 'b'},
{year: '1988', title: 'title2', location: 'a'},
{year: '1989', title: 'title3', location: 'c'}
];
=>
const simpleArr2 = [
{
year: '1988',
places: [
{title: 'title1', location: 'b'},
{title: 'title2', location: 'a'},
]
},
{
year: '1989',
places: [{title: 'title3', location: 'c'}]
}]
BC
const simplaArr = [
{year: '1988', title: 'tile1', location: 'b'},
{year: '1988', title: 'title2', location: 'a'},
{year: '1989', title: 'title3', location: 'c'}
];
=>
const simpleArr2 = [
{
year: '1988',
places: [
{title: 'title1', location: 'b'},
{title: 'title2', location: 'a'},
]
},
{
year: '1989',
places: [{title: 'title3', location: 'c'}]
}]
simpleArr2.map(({year, places}) => ({year, ...places}))
DT
BC
DT