This commit is contained in:
Peter Maquiran
2022-01-29 19:21:46 +01:00
parent bf0dbf8baf
commit ed77e1aea7
14 changed files with 402 additions and 19 deletions
+6
View File
@@ -0,0 +1,6 @@
// 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 }));
}, {});