I want to convert the following data:
[
{ a: 2000, b: 4000 },
{ a: 8000, b: 5000 },
{ a: 6000, b: 1000 }
];
Into this format:
[
[ 2000, 8000, 6000 ],
[ 4000, 5000, 1000 ]
];
Using Ramda library.
I am able to achieve this using R.reduce function, but I am exploring if there is a more efficient way using built-in functions provided by Ramda.
One important point; the solution should not assume fixed keys in the objects. The keys will remain consistent across objects but may vary each time the function runs. For instance, consider the following input:
Input:
[
{ c: 1000, d: 4000, e: 7000 },
{ c: 2000, d: 5000, e: 8000 },
{ c: 3000, d: 6000, e: 9000 }
];
Result:
[
[ 1000, 2000, 3000 ],
[ 4000, 5000, 6000 ],
[ 7000, 8000, 9000 ],
];