Convert an array to a object in TypeScript
To convert an array to a object in typescript you can use the following helper function
Array to Object function
function arrayToObject(array: any[]): Object {
array.reduce((obj, item) => {
obj[item.id] = item;
return obj;
}, {});
}