1234567891011121314151617181920212223242526 |
- export default function flattenListOfObjects(
- objs: Array<Record<string, any[] | undefined>>
- ) {
- return objs.reduce((acc, obj) => {
- Object.entries(obj).forEach(([key, value]) => {
- if (!Array.isArray(value)) {
-
-
-
- throw new Error('Invalid value');
- }
- acc[key] = (acc[key] || []).concat(value);
- });
- return acc;
- }, {});
- }
|