Accumulate values by key from an array of objects (key/value mappings):
records = [
{ a: 10, b: 20, c: 30 },
{ a: 11, b: 21 },
{ a: 12, b: 22, c: 32, d: 42 }
]
pivoted = pivot(records)
Expected result:
pivoted = {
a: [ 10, 11, 12 ],
b: [ 20, 21, 22 ],
c: [ 30, 32 ],
d: [ 42 ]
}
Worked for me nicely :)