On the problem of data conversion

let fundList = [

]
{
    name: "a",
    id: 0,
},
{
    name: "b",
    id: 1,
}

];
let beforeData = [

{
    "approved_amount_sum": 44200,
    "date": "2018-08-07",
    "a": 44200,
    "a_rate": 1,
},
{
    "approved_amount_sum": null,
    date: "2018-08-08",
},

]
let data = [

{
    "approved_amount_sum": 44200,
    "date": "2018-08-07",
    "a": 44200,
    "a_rate": 1,
    "b": null,
    "b_rate": null,
},
{
    "approved_amount_sum": null,
    "date": "2018-08-08",
    "a": null,
    "a_rate": null,
    "b": null,
    "b_rate": null,
},

]
you need to match name and beforeData according to the name in fundList, add those that are not in beforeData, and add the variable of name_rate. I would like to ask the passing god how to write this

.
Apr.09,2021

let fundObj = fundList.reduce((t,c)=>{
    t[c.name] = null;
    t[c.name + '_rate'] = null;
    return t;
}, {});

let afterData = beforeData.map(o => Object.assign({}, fundObj, o));
console.log(afterData);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b401cb-2bc63.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b401cb-2bc63.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?