mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
6 lines
229 B
JavaScript
6 lines
229 B
JavaScript
// https://stackoverflow.com/a/68628927/14115342
|
|
|
|
const ArrayToObject = (array = [], getKey) => array.reduce((obj, cur) => {
|
|
const key = getKey(cur);
|
|
return (Object.assign(Object.assign({}, obj), { [key]: cur }));
|
|
}, {}); |