es6 convert array to object key value 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;
}, {});