Aggregate same key values into an array and avoid undefined
问题 I am trying to aggregate the same key values into an array by value. so for example I have an array of objects, like so const data = [{foo: true},{foo: false},{bar: true},{buzz: false}] when they get aggregated the array transforms into [ foo: {true: [{foo: true}], false: [{foo: false}]}, bar: {true: [{bar: true}]}, buzz: {false: [{buzz: false}]} ] the array entries is the original object. Now I know the keys that I want to group by.. they are foo, bar, buzz and fizz. But fizz is not part of