I have an array that looks like this:
var arr = [
[
"2021-07-31T00:00:00Z",
"648429a0-00e5-4752-9d84-2857a0ea0787"
],
[
"2021-08-31T00:00:00Z",
"648429a0-00e5-4752-9d84-2857a0ea0787"
],
[
"2021-07-31T00:00:00Z",
"AAAA"
],
[
"2021-08-31T00:00:00Z",
"BBBB"
]
]
I'd like to transform this based on the first value (the date) of each array. So if the dates match they will merge into one. So the output I'm trying to get is
[
[
"2021-07-31T00:00:00Z",
"648429a0-00e5-4752-9d84-2857a0ea0787",
"AAAA"
],
[
"2021-08-31T00:00:00Z",
"648429a0-00e5-4752-9d84-2857a0ea0787",
"BBBB"
]
]
Would be grateful to know what would be the best approach in this instance.