convert array of objects into object of objects code example
Example: es6 array to object keys
const subLocationTypes = (location.subLocationTypes || []).reduce((add, cur) => {
add[cur.key] = cur.value;
return add;
}, {});
const subLocationTypes = (location.subLocationTypes || []).reduce((add, cur) => {
add[cur.key] = cur.value;
return add;
}, {});