I have an array like this:
var flightPlanCoordinates = [
{ lat: 37.772, lng: -122.214, status: "walking" },
{ lat: 36.772, lng: -123.214, status: "walking" },
{ lat: 21.291, lng: -157.821, status: "automotive" },
{ lat: -18.142, lng: 178.431, status: "automotive" },
{ lat: -27.467, lng: 153.027, status: "walking" },
{ lat: -26.467, lng: 151.027, status: "walking" },
];
and I want this to be split up into three arrays that have objects that have the same type like this following format:
[{lat: 37.772, lng: -122.214, status: 'walking'},
{lat: 36.772, lng: -123.214, status: 'walking'}]
[{lat: 21.291, lng: -157.821, status: 'automotive'},
{lat: -18.142, lng: 178.431, status: 'automotive'}]
[{lat: -27.467, lng: 153.027, status: 'walking'}
{lat: -26.467, lng: 151.027, status: 'walking'}]
I cannot just use groupBy to handle this, any ideas?