function arr_to_obj(arr){
var obj = {};
arr.forEach(el=>obj[el.name]=el.data);
return obj;
}
arr_to_obj([
{name:'t1',data: 11},
{name: 't2', data: 22}
]);
{
t1: 11,
t2: 22
}
const arrToObj = arr => arr.reduce((acc, item) => ({...acc, [item.name]: item.data}), {})