reduce - dynamic

PHOTO EMBED

Wed Feb 12 2025 23:20:21 GMT+0000 (Coordinated Universal Time)

Saved by @davidmchale #reducer #reduce

  let grouping = items.reduce((obj, item) => {
            const key = item.providerId;
            if (!obj[key]) {
                obj[key] = [];
            }

            obj[key].push(item);

            return obj;
        }, {});
content_copyCOPY